question: 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 ( FileUtils . newOutputStream ( fileName , false ) ) ; } catch ( Exception e ) { throw new IOException ( e . toString ( ) , 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 ( ) ; }
target:  Store a properties file. The header and the date is not written.