private void skipBytes()

in src/main/java/com/epam/parso/impl/SasFileParser.java [393:416]


    private void skipBytes(long numberOfBytesToSkip) throws IOException {

        long remainBytes = numberOfBytesToSkip;
        long readBytes;
        while (remainBytes > 0) {
            try {
                readBytes = sasFileStream.read(SKIP_BYTE_BUFFER, 0,
                        (int) Math.min(remainBytes, SKIP_BYTE_BUFFER.length));
                if (readBytes < 0) { // EOF
                    break;
                }
            } catch (IOException e) {
                throw new IOException(EMPTY_INPUT_STREAM);
            }
            remainBytes -= readBytes;
        }

        long actuallySkipped = numberOfBytesToSkip - remainBytes;

        if (actuallySkipped != numberOfBytesToSkip) {
            throw new IOException("Expected to skip " + numberOfBytesToSkip
                    + " to the end of the header, but skipped " + actuallySkipped + " instead.");
        }
    }