/** * Store a properties file. The header and the date is not written. * * @param fileName the target file name */ public synchronized void store(String fileName) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); store(out, null); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); InputStreamReader reader = new InputStreamReader(in, "ISO8859-1"); LineNumberReader r = new LineNumberReader(reader); Writer w; try { w = new OutputStreamWriter(IOUtils.openFileOutputStream(fileName, false)); } catch (Exception e) { throw DbException.convertToIOException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter(w)); while (true) { String line = r.readLine(); if (line == null) { break; } if (!line.startsWith("#")) { writer.print(line + "\n"); } } writer.close(); }