{
if (buffer.size() > 0) {
Slice slice = buffer.slice();
byte[] compressedBytes = new byte[Snappy.maxCompressedLength(slice.length())];
int actualLength = Snappy.compress(slice.getBytes(), 0, slice.length(), compressedBytes, 0);
SnappyBlock block = new SnappyBlock(tupleCount, encoding.getTupleInfo(), Slices.wrappedBuffer(Arrays.copyOf(compressedBytes, actualLength)));
encoding.writeBlock(sliceOutput, block);
buffer.reset();
tupleCount = 0;
}
}