private void fillBuffer(final InputStream stream, final byte[] buffer, final int offset, final int len)
            throws IOException {
        final int realLen = stream.read(buffer, offset, len);

        if (realLen == -1) {
            throw new IOException("Unable to fill buffer");
        }
        if (realLen != len) {
            // Try Again
            fillBuffer(stream, buffer, offset + realLen, len - realLen);
        }
    }
Do fill a buffer to an exact size.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/BlockGZIPInput.java