Java: Write to file

An easy piece of code to write to a file:

  BufferedWriter out = new BufferedWriter
       (new OutputStreamWriter(new FileOutputStream("c:\\LOGS\\MyParameter.txt"),"UTF-8"));           
            out.write("parameter: " + parameter);
            out.close();

Leave a Reply