public class SortedConfigurationWriter extends java.lang.Object
Configuration
instance into a property file, where
the keys are sorted by their name. Writing sorted keys make it easier for
users to find and change properties in the file.Constructor and Description |
---|
SortedConfigurationWriter()
The default constructor, does nothing.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getDescription(java.lang.String key)
Returns a description for the given key.
|
void |
save(java.io.File file,
Configuration config)
Saves the given configuration into a file specified by the given
file object.
|
void |
save(java.io.OutputStream outStream,
Configuration config)
Writes the configuration into the given output stream.
|
void |
save(java.lang.String filename,
Configuration config)
Saves the given configuration into a file specified by the given
filename.
|
public SortedConfigurationWriter()
protected java.lang.String getDescription(java.lang.String key)
key
- the key for which a description should be printed.public void save(java.lang.String filename, Configuration config) throws java.io.IOException
filename
- the filenameconfig
- the configurationjava.io.IOException
- if an IOError occurs.public void save(java.io.File file, Configuration config) throws java.io.IOException
file
- the target fileconfig
- the configurationjava.io.IOException
- if an IOError occurs.public void save(java.io.OutputStream outStream, Configuration config) throws java.io.IOException
outStream
- the target output streamconfig
- the configurationjava.io.IOException
- if writing fails.