@Test public void testFacarde() { IFacade f = Values.newNativeReference(IFacade.class); Byteable byteable = (Byteable) f; long capacity = byteable.maxSize(); byteable.bytesStore(NativeBytesStore.nativeStore(capacity), 0, capacity); System.out.println(f); }
private LongArrayValues getIndex2index(@NotNull Wire wire) throws UnrecoverableTimeoutException { LongArrayValuesHolder holder = getIndex2IndexArray(); LongArrayValues values = holder.values; if (((Byteable) values).bytesStore() != null) return values; final long indexToIndex = index2Index.getVolatileValue(); try (DocumentContext ignored = wire.readingDocument(indexToIndex)) { return array(wire, values, true); } }
@Override public long size() { return instance.maxSize(); }
@Override public long offset() { return instance.offset(); }
if (((Byteable) index2indexArr).bytesStore() == null) { assert false; return;
@Override public long size() { return instance.maxSize(); }
@Override public long offset() { return instance.offset(); }
@Override public void init(JLBH jlbh) { IOTools.deleteDirWithFiles("replica", 10); Byteable byteable = (Byteable) datum; long capacity = byteable.maxSize(); byteable.bytesStore(NativeBytesStore.nativeStore(capacity), 0, capacity); datumBytes = ((Byteable) datum).bytesStore(); datumWrite = datumBytes.bytesForWrite(); sourceQueue = single("replica").build(); sinkQueue = single("replica").build(); appender = sourceQueue.acquireAppender(); tailer = sinkQueue.createTailer(); this.jlbh = jlbh; }
@Override public RandomDataInput bytes() { return instance.bytesStore(); }
@NotNull @Override public T read(@NotNull Bytes in, long size, @Nullable T using) { if (size != nativeReference.maxSize()) throw new IllegalArgumentException(); return read(in, using); }
private void initTransients() { nativeInstance = (Byteable) Values.newNativeReference(valueType); nativeInstanceAsCopyable = (Copyable) nativeInstance; nativeClass = (Class<? extends T>) nativeInstance.getClass(); heapClass = Values.heapClassFor(valueType); nativeInstance.bytesStore(allocateBytesStoreForInstance(), 0, nativeInstance.maxSize()); }
@Override public RandomDataInput bytes() { return instance.bytesStore(); }
private BytesStore allocateBytesStoreForInstance() { long instanceSize = nativeInstance.maxSize(); if (instanceSize > Bytes.MAX_BYTE_BUFFER_CAPACITY) { return NativeBytesStore.nativeStoreWithFixedCapacity(instanceSize); } else { return BytesStore.wrap(ByteBuffer.allocate(Maths.toUInt31(instanceSize))); } }
@NotNull @Override public T read(Bytes in, @Nullable T using) { if (using != null && using.getClass() == nativeClass) { ((Byteable) using).bytesStore(in.bytesStore(), in.readPosition(), nativeReference.maxSize()); return using; } if (using == null) using = createInstance(); nativeReference.bytesStore(in.bytesStore(), in.readPosition(), nativeReference.maxSize()); ((Copyable) using).copyFrom(nativeReference); return using; }
@Override public T getUsing(@Nullable T using) { if (using == null) using = createInstance(); using.bytesStore(instance.bytesStore(), offset(), size()); return using; }
reader(new ByteableSizedReader<>((Class) tClass)); dataAccess((DataAccess<T>) new ByteableDataAccess<>((Class) tClass)); sizeMarshaller(constant(allocateByteable(tClass).maxSize())); } else if (tClass == CharSequence.class) { reader((SizedReader<T>) CharSequenceSizedReader.INSTANCE);
@NotNull @Override public final T read(@NotNull Bytes in, long size, @Nullable T using) { if (using == null) using = createInstance(); using.bytesStore(in.bytesStore(), in.readPosition(), size); return using; } }
private LongArrayValues getIndex2index(@NotNull Wire wire) throws UnrecoverableTimeoutException { LongArrayValuesHolder holder = getIndex2IndexArray(); LongArrayValues values = holder.values; if (((Byteable) values).bytesStore() != null) return values; final long indexToIndex = index2Index.getVolatileValue(); try (DocumentContext ignored = wire.readingDocument(indexToIndex)) { return array(wire, values, true); } }
if (((Byteable) index2indexArr).bytesStore() == null) { assert false; return;