With Scala, what is the best way to read from an InputStream to a bytearray?
I can see that you can convert an InputStream to char array
Source.fromInput
def inputStreamToByteArray(is: InputStream): Array[Byte] = { val buf = ListBuffer[Byte]() var b = is.read() while (b != -1) { buf.append(b.byteValue) b = is.read() } buf.toArray }