presto-orc/src/main/java/io/prestosql/orc/stream/AbstractDiskOrcDataReader.java/AbstractDiskOrcDataReader/seekBuffer
class AbstractDiskOrcDataReader:    @Override
    public final Slice seekBuffer(int newPosition)
            throws IOException
    {
        int newBufferSize = toIntExact(min(dataSize - newPosition, maxBufferSize));
        if (buffer == null || buffer.length < newBufferSize) {
            buffer = new byte[newBufferSize];
        }

        // is the new position withing the current buffer
        if (newPosition > bufferStartPosition && newPosition < bufferStartPosition + bufferSize) {
            // move existing data to the start of the buffer
            int overlapSize = (bufferStartPosition + bufferSize) - newPosition;
            System.arraycopy(buffer, bufferSize - overlapSize, buffer, 0, overlapSize);

            // fill the remaining part of the buffer
            read(newPosition + overlapSize, buffer, overlapSize, newBufferSize - overlapSize);
        }
        else {
            read(newPosition, buffer, 0, newBufferSize);
        }

        bufferSize = newBufferSize;
        bufferStartPosition = newPosition;
        return Slices.wrappedBuffer(buffer, 0, bufferSize);
    }