title: Fastest way to write to file?
body: <p>I made a method that takes a <code>File</code> and a <code>String</code>.  It replaces the file with a new file with that string as its contents.</p>
  
  <p>This is what I made:  </p>
  
  <pre><code>public static void Save(File file, String textToSave) {
  
      file.delete();
      try {
          BufferedWriter out = new BufferedWriter(new FileWriter(file));
          out.write(textToSave);
          out.close();
      } catch (IOException e) {
      }
  }
  </code></pre>
  
  <p>However it is painfully slow.  It sometimes takes over a minute.</p>
  
  <p>How can I write large files with tens of thousands to maybe up to a million characters in them?</p>