public void save()
{

    //create a buffered writer stream

    FileOutputStream fileOutputStream = null;
    OutputStreamWriter outputStreamWriter = null;
    BufferedWriter out = null;

    try{

        fileOutputStream = new FileOutputStream(filename);
        outputStreamWriter =
                        new OutputStreamWriter(fileOutputStream, fileFormat);
        out = new BufferedWriter(outputStreamWriter);

        ListIterator i;

        //write each line in the buffer to the file

        for (i = buffer.listIterator(); i.hasNext(); ){
            out.write((String)i.next());
            out.newLine();
            }

        //Note! You MUST flush to make sure everything is written.

        out.flush();

    }
    catch(IOException e){
        logSevere(e.getMessage() + " - Error: 394");
    }
    finally{
        try{if (out != null) {out.close();}}
        catch(IOException e){}
        try{if (outputStreamWriter != null) {outputStreamWriter.close();}}
        catch(IOException e){}
        try{if (fileOutputStream != null) {fileOutputStream.close();}}
        catch(IOException e){}
    }

}//end of IniFile::save