A PrintStream uses a BufferedWriter to write, which in turn uses this line separator:
/**
* Line separator string. This is the value of the line.separator
* property at the moment that the stream was created.
*/
private String lineSeparator;
You can thus use System.setProperty("line.separator", "\r\n")
to set the default line separator, but it will only affect newly created PrintStreams (e.g. System.out
will most likely not be affected).