gradle-josm-plugin / org.openstreetmap.josm.gradle.plugin.i18n.io / java.io.InputStream

Extensions for java.io.InputStream

readAllOrException

fun InputStream.readAllOrException(b: ByteArray): Int

Read bytes from the input stream into the array. If there are not enough bytes to fill the array, an exception is thrown.

readTwoBytesAsInt

fun InputStream.readTwoBytesAsInt(): Int

Read the next two bytes from the InputStream, interpret them as a big-endian number (first byte most significant). This number is then returned.

skipAllOrException

fun InputStream.skipAllOrException(n: UInt): UInt

Skip over n bytes. If there are only less than n bytes to skip over, an exception is thrown.