title: Rewriting into a file
body: <p>I write a simple function like this:</p>
  
  <pre><code>private static void write(String Swrite) throws IOException {
     if(!file.exists()) {
        file.createNewFile();
     }
     FileOutputStream fop=new FileOutputStream(file);
     if(Swrite!=null)
        fop.write(Swrite.getBytes());
     fop.flush();
     fop.close();
  }
  </code></pre>
  
  <p>Every time I call it, it rewrite and then I just get the last items that are written. How can I change it to not rewriting? The <code>file</code> variable is defined globally as a <code>File</code>.</p>