title: Strings written to file do not preserve line breaks
body: <p>I am trying to write a <code>String</code>(lengthy but wrapped), which is from <code>JTextArea</code>. When the string printed to console, formatting is same as it was in <code>Text Area</code>, but when I write them to file using BufferedWriter, it is writing that <code>String</code> in single line.</p>
  
  <p>Following snippet can reproduce it:</p>
  
  <pre><code>public class BufferedWriterTest {
      public static void main(String[] args) throws IOException {
          String string = "This is lengthy string that contains many words. So\nI am wrapping it.";
          System.out.println(string);
          File file = new File("C:/Users/User/Desktop/text.txt");
          FileWriter fileWriter = new FileWriter(file);
          BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
          bufferedWriter.write(string);
          bufferedWriter.close();
      }
  }
  </code></pre>
  
  <p>What went wrong? How to resolve this? Thanks for any help!</p>