Im trying to export some data from my database to a file. I m using the DataOutputStream
because I need the method writeChars(String r)
.
The problem is that I cannot find a way to change the line. the "\n"
leaves a space but its not changing the line. Is there any way to do it?
If you just want to write text to a file you have chosen the wrong class. DataOuputStream.writeChars always writes characters in UTF-16BE. Use BufferedWriter or PrintWriter instead. PrintWriter.println appends a platform specific line separator to the end of the line. The line separator is defined by the system property line.separator, and is not necessarily a single newline character ('\n'). E.g for Windows "\r\n", for Unix '\n' etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With