Assuming I should write to a binary. I can use the following code
val fos = new FileOutputStream("fileName")
and then use
fos.write(bytes)
Is it always a good idea to combine it with a buffered stream? how in:
val fos = new FileOutputStream("FileName") val bos = new BufferedOutputStream(fos)
Does the same rule FileInputStream for FileInputStream ?
Do I need to close fos at the end (in the chain version)?
EDIT: Found the answer to the last question. There is no need to close internal threads as indicated here.
source share