fun skipBytes()

in plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/util/pngj/PngHelperInternal.kt [174:190]


    fun skipBytes(inputStream: InputPngStream, len: Long) {
        @Suppress("NAME_SHADOWING")
        var len = len
        try {
            while (len > 0) {
                val n1: Long = inputStream.skip(len)
                if (n1 > 0) {
                    len -= n1
                } else if (n1 == 0L) { // should we retry? lets read one byte
                    if (inputStream.read() == -1) // EOF
                        break else len--
                } else throw Throwable("skip() returned a negative value ???")
            }
        } catch (e: Throwable) {
            throw PngjInputException(e)
        }
    }