public void serialize(ReadResponse response, DataOutput dos, int version) throws IOException { dos.writeInt(response.isDigestQuery() ? response.digest().remaining() : 0); ByteBuffer buffer = response.isDigestQuery() ? response.digest() : ByteBufferUtil.EMPTY_BYTE_BUFFER; ByteBufferUtil.write(buffer, dos); dos.writeBoolean(response.isDigestQuery()); if (!response.isDigestQuery()) Row.serializer.serialize(response.row(), dos, version); }
public long serializedSize(ReadResponse response, int version) { TypeSizes typeSizes = TypeSizes.NATIVE; ByteBuffer buffer = response.isDigestQuery() ? response.digest() : ByteBufferUtil.EMPTY_BYTE_BUFFER; int size = typeSizes.sizeof(buffer.remaining()); size += typeSizes.sizeof(response.isDigestQuery()); if (!response.isDigestQuery()) size += Row.serializer.serializedSize(response.row(), version); return size; }