append text to the end of the file
<p>I am using the below code segment to write text to the end o the file for each time it is called. But, it is erasing the old data and then writes the new data to the beginning of the file. How can I fix the below code so that it is append new data <strong>always</strong> end of the file ?</p>

<pre><code>public boolean writeToFile(String directory, String filename, String data ){
    File out;
    OutputStreamWriter outStreamWriter = null;
    FileOutputStream outStream = null;

    out = new File(new File(directory), filename);

    if ( out.exists() == false ){
                out.createNewFile();
    }

    outStream = new FileOutputStream(out) ;
    outStreamWriter = new OutputStreamWriter(outStream); 

    outStreamWriter.append(data);
    outStreamWriter.flush();
   }        
</code></pre>
