@Override public CachedData encode(HFileBlock block) { ByteBuffer bb = ByteBuffer.allocate(block.getSerializedLength()); block.serialize(bb, true); return new CachedData(0, bb.array(), CachedData.MAX_SIZE); }
@Override public void serialize(ByteBuffer destination, boolean includeNextBlockMetadata) { this.buf.get(destination, 0, getSerializedLength() - BLOCK_METADATA_SPACE); destination = addMetaData(destination, includeNextBlockMetadata); // Make it ready for reading. flip sets position to zero and limit to current position which // is what we want if we do not want to serialize the block plus checksums if present plus // metadata. destination.flip(); }
ByteBuffer serialized = ByteBuffer.allocate(blockFromHFile.getSerializedLength()); blockFromHFile.serialize(serialized, true); HFileBlock deserialized =
@Override public CachedData encode(HFileBlock block) { ByteBuffer bb = ByteBuffer.allocate(block.getSerializedLength()); block.serialize(bb); return new CachedData(0, bb.array(), CachedData.MAX_SIZE); }
@Override public void serialize(ByteBuffer destination) { ByteBufferUtils.copyFromBufferToBuffer(destination, this.buf, 0, getSerializedLength() - EXTRA_SERIALIZATION_SPACE); serializeExtraInfo(destination); }
ByteBuffer serialized = ByteBuffer.allocate(blockFromHFile.getSerializedLength()); blockFromHFile.serialize(serialized, true); HFileBlock deserialized =