I am new to File Streams and would appreciate some help. The following code is the code I use to write to a specified file.
OutputStream outStream = new FileOutputStream(file);
outStream.write(contentsToWrite.getBytes());
outStream.close();
- How do I save different lines to a file? In my case using
\n
does not work when writing to a file. - How do I save a line to the file without deleting the other lines?