risolto

String doc = editor.getText();
int docLength = doc.length();
try {
FileWriter fw = new FileWriter(fileAbsPath);
//fw.write(doc, 0, docLength);
PrintWriter out
= new PrintWriter(new BufferedWriter(fw));
StringTokenizer st = new StringTokenizer(doc, "\n");
while (st.hasMoreTokens()) {
out.write(st.nextToken());
out.write("#");
}
;
out.close();
} catch (IOException ioe) {
JOptionPane.showMessageDialog(null, ioe);
}