in runtime/testing/jvm/src/aws/smithy/kotlin/runtime/testing/RandomInputStream.kt [30:49]
override fun read(b: ByteArray, off: Int, len: Int): Int {
// Signal that we're out of data if we've hit our limit
if (remainingBytes <= 0) {
return -1
}
var bytesToRead = len
if (bytesToRead > remainingBytes) {
bytesToRead = remainingBytes.toInt()
}
remainingBytes -= bytesToRead.toLong()
if (binaryData) {
val endExclusive = off + bytesToRead
Random.nextBytes(b, off, endExclusive)
} else {
for (i in 0 until bytesToRead) {
b[off + i] = Random.nextInt(MIN_CHAR_CODE, MAX_CHAR_CODE + 1).toByte()
}
}
return bytesToRead
}