@Override
    public int read(@NotNull final byte[] bytes, final int off, final int tryLen) throws IOException {
        int realLen = tryLen;

        // Are we going to read past the length of the file?
        if ((position + tryLen) > dataLength) {
            // Trim the length
            realLen = (int) (dataLength - position);
        }
        // Have we already past the EOF ?
        if (position >= dataLength) {
            return -1;
        }

        // How many bytes can we read from this block.
        final int bytesLeftInBlock = (blockSize - (int) (position % blockSize));

        // Start a BGZIP block
        if (currentStream == null) {
            startGzipBlock();
        }

        // You need to take care the calling read() may not read the full length
        // of the buffer So we have to ensure we increment our position by
        // realLen.

        // Only ever read from one block (make the caller do another read())
        // So don't read more bytes than we have left
        realLen = Math.min(bytesLeftInBlock, realLen);

        // Read the GZIP strip
        realLen = currentStream.read(bytes, off, realLen);
        if (realLen != -1) {
            position += realLen;
            // Hit the end
            if ((position % blockSize) == 0) {
                endGzipBlock();
            }
        }
        return realLen;
    }
Read some uncompressed data from our stream.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/BlockGZIPInput.java