presto-orc/src/main/java/io/prestosql/orc/stream/CompressedOrcChunkLoader.java/CompressedOrcChunkLoader/nextChunk
class CompressedOrcChunkLoader:    @Override
    public Slice nextChunk()
            throws IOException
    {
        // 3 byte header
        // NOTE: this must match BLOCK_HEADER_SIZE
        ensureCompressedBytesAvailable(3);
        lastCheckpoint = createInputStreamCheckpoint(getCurrentCompressedOffset(), nextUncompressedOffset);
        int b0 = compressedBufferStream.readUnsignedByte();
        int b1 = compressedBufferStream.readUnsignedByte();
        int b2 = compressedBufferStream.readUnsignedByte();

        boolean isUncompressed = (b0 & 0x01) == 1;
        int chunkLength = (b2 << 15) | (b1 << 7) | (b0 >>> 1);

        ensureCompressedBytesAvailable(chunkLength);
        Slice chunk = compressedBufferStream.readSlice(chunkLength);

        if (!isUncompressed) {
            int uncompressedSize = decompressor.decompress(
                    (byte[]) chunk.getBase(),
                    (int) (chunk.getAddress() - ARRAY_BYTE_BASE_OFFSET),
                    chunk.length(),
                    createOutputBuffer());
            chunk = Slices.wrappedBuffer(decompressorOutputBuffer, 0, uncompressedSize);
        }
        if (nextUncompressedOffset != 0) {
            chunk = chunk.slice(nextUncompressedOffset, chunk.length() - nextUncompressedOffset);
            nextUncompressedOffset = 0;
            // if we positioned to the end of the chunk, read the next one
            if (chunk.length() == 0) {
                chunk = nextChunk();
            }
        }
        return chunk;
    }