Created
May 27, 2014 10:36
-
-
Save tomer-ben-david/1f2611db1d0851a65d43 to your computer and use it in GitHub Desktop.
write bytes to file in scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is misusing of "continually". You don't have any operation to execute continually here. Makes absolutely the same as:
Here is good example of use "continually":