public void print(Printable p, String file) { PrintStream ps = null; boolean state = FileUtils.doesFileExist(file); try { ps = new PrintStream(new FileOutputStream(file, true)); } catch (Exception e) { e.printStackTrace(); ps = System.err; } if (!state) { ps.print(p.getHeader() + ",\"Notes\"\r\n"); } ps.print(p.getData()); ps.print(",\"" + p.getNotes() + "\"\r\n"); ps.flush(); ps.close(); }