org.pf.file
Class PropertiesFileWriter

java.lang.Object
  extended by org.pf.file.PropertiesFileWriter

public class PropertiesFileWriter
extends java.lang.Object

Writes ordered properties with preserved comments and blank lines to a file.

Version:
1.1
Author:
Manfred Duchrow

Constructor Summary
PropertiesFileWriter()
          Initialize the new instance with default values.
 
Method Summary
 void writeTo(java.lang.String filename, PropertiesFileContent properties)
          Writes the given properties including all comments and blank lines to a file with the specified name.
 void writeTo(java.io.Writer writer, PropertiesFileContent properties)
          Writes the given properties including all comments and blank lines to the given writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFileWriter

public PropertiesFileWriter()
Initialize the new instance with default values.

Method Detail

writeTo

public void writeTo(java.lang.String filename,
                    PropertiesFileContent properties)
             throws java.io.IOException
Writes the given properties including all comments and blank lines to a file with the specified name.

Parameters:
filename - The name of the file to write to
properties - The properties to write
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.Writer writer,
                    PropertiesFileContent properties)
             throws java.io.IOException
Writes the given properties including all comments and blank lines to the given writer. When the method is finished the writer is closed. That is also true if an exception was thrown.

Parameters:
writer - The writer object to write the properties to
properties - The properties to write
Throws:
java.io.IOException