ziggy42
01/16/2018, 2:25 PMr4zzz4k
01/16/2018, 3:09 PMziggy42
01/16/2018, 3:10 PMgetInputStream().asBytes()
but I need to have the stream in a variabler4zzz4k
01/16/2018, 3:14 PMziggy42
01/16/2018, 4:28 PMval inputStream = getFileInputStream()
inputStream.readBytes(inputStream.available())
r4zzz4k
01/16/2018, 4:35 PMfun InputStream.readAvailableBytes(): ByteArray = this.readBytes(this.available())
ziggy42
01/16/2018, 4:36 PMr4zzz4k
01/16/2018, 4:38 PMreadBytes(0)
due to this: val buffer = ByteArrayOutputStream(Math.max(estimatedSize, this.available()))
https://github.com/JetBrains/kotlin/blob/1.2.0/libraries/stdlib/src/kotlin/io/IOStreams.kt#L115ziggy42
01/16/2018, 4:41 PMr4zzz4k
01/16/2018, 4:45 PMavailable()
can be small, but more data will appear as soon as you start pulling. So it's reasonable to have some minimal buffer size. In your case it sounds more logical to pass 0.ziggy42
01/16/2018, 5:07 PM