tomer-ben-david
5/27/2014 - 10:36 AM

write bytes to file in scala

write bytes to file in scala

val byteArray: Array[Byte] = Array(1,2)
val bos = new BufferedOutputStream(new FileOutputStream(filename))
Stream.continually(bos.write(byteArray))
bos.close() // You may end up with 0 bytes file if not calling close.