presto-orc/src/main/java/io/prestosql/orc/metadata/CompressedMetadataWriter.java/CompressedMetadataWriter/getSliceOutput
class CompressedMetadataWriter:    private Slice getSliceOutput()
    {
        buffer.close();
        DynamicSliceOutput output = new DynamicSliceOutput(toIntExact(buffer.getOutputDataSize()));
        buffer.writeDataTo(output);
        Slice slice = output.slice();
        buffer.reset();
        return slice;
    }