public static long skip(final InputStream inputStream, final long totalBytesToSkip) throws IOException {
        long bytesToSkip = totalBytesToSkip;
        while (bytesToSkip > 0) {
            final long skip = inputStream.skip(bytesToSkip);
            if (skip < 0) {
                break;
            }
            bytesToSkip -= skip;
        }
        return totalBytesToSkip - bytesToSkip;
    }
Try a read a full buffer from a stream.

@param stream to read from
@param buffer to read into
@throws IOException if error
stroom-util/src/main/java/stroom/util/io/StreamUtil.java