How to free the content of a file?
<p>I want to write in a file, if it exists i would like to free the content and to write from the begining of the file this the code that i use but i dont now how to do that.</p>

<pre><code>try {
            File f = new File(testPath + "/logtest.txt");
            if (f.exists()) {
                f.delete();                                                                                             
                BufferedWriter bw = new BufferedWriter(new FileWriter(f, true));
                bw.write(text);
                bw.newLine();
                bw.close();
            } else {
                BufferedWriter bw = new BufferedWriter(new FileWriter(f, true));
                bw.write(text);
                bw.newLine();
                bw.close();

            }
        } catch (Exception e) {

        }
</code></pre>
