You do not necessarily want to use '\n' as a global newline. Better to make a static variable that is available in an interface that queries line.separator once:
static final public String EOL = System.getProperty("line.separator");
Regarding the tab character (and the newline as well), the special characters ('\t', \n', etc.) can be encoded for something other than UTF-8. The most likely example would be if you have to write a legacy interface for an EBCDIC mainframe or mini-computer. In this case, you can somewhat guarantee the correct output by:
Writer writer = new OutputStreamWriter(out, encoding);
- Saish
"My karma ran over your dogma." - Anon