@Override public void uninit() { array = null; bs.uninit(); }
@Override public long offset() { return bs.start(); }
static void writeMany(Bytes bytes, int size) { for (int i = 0; i < size; i += 32) { bytes.writeInt(i);// 4 bytes bytes.writeFloat(i);// 4 bytes bytes.writeLong(i);// 8 bytes bytes.writeDouble(i);// 8 bytes bytes.writeUtf8("Hello!!"); // 8 bytes } }
public BytesWithIndex(Bytes<?> bytes, long index) { this.bytes = Bytes.allocateElasticDirect(bytes.readRemaining()).write(bytes); this.index = index; }
@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; }
static File getFile(MappedBytes bytes) { if (bytes == null) return new File("none"); MappedFile mappedFile = bytes.mappedFile(); assert (mappedFile != null); File file = mappedFile.file(); assert (file != null); return file; }
@Override public void close() { bytes.release(); } }
@After public void checkRegisteredBytes() { outgoingBytes.release(); BytesUtil.checkRegisteredBytes(); } }
@Override public void close() { textConversionTarget.release(); } }
private void initTransients() { bs = HeapBytesStore.uninitialized(); }
private void onCleanup() { mappedBytes.release(); }
@Override public long size() { return bs.capacity(); }
@After public void checkRegisteredBytes() { BytesUtil.checkRegisteredBytes(); } }
@Override public void close() { textConversionTarget.release(); } }