edu.harvard.hul.ois.jhove
Class ConfigWriter
java.lang.Object
edu.harvard.hul.ois.jhove.ConfigWriter
public class ConfigWriter
- extends java.lang.Object
Class to write out configuration information to the configuration file.
To minimize the chance of getting into a bad state, it writes to a
temporary file, then replaces the old config file with that file,
rather than directly overwriting the existing file.
- Author:
- Gary McGath
Method Summary |
void |
writeFile(java.util.List<ModuleInfo> modules,
java.util.List<java.lang.String[]> handlers,
java.io.File homeDir,
java.io.File tempDir,
java.lang.String encoding,
int bufferSize)
Writes out the content of the file to the temporary file,
then deletes the existing configuration file (as specified
by the constructor parameter) and renames the temporary file
to the configuration file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConfigWriter
public ConfigWriter(java.io.File file,
ConfigWindow parent)
throws java.io.IOException
- Constructor.
Creates a temporary file for writing and creates an OutputStreamWriter
to write to it. If there is already a file located by
file
, it will not be replaced or overwritten
until writeFile
has successfully written out
the temporary file.
- Parameters:
file
- Location of the configuration fileparent
- The ConfigWindow which invoked this instance.
May be null if invoked to write a default config file.
- Throws:
java.io.IOException
writeFile
public void writeFile(java.util.List<ModuleInfo> modules,
java.util.List<java.lang.String[]> handlers,
java.io.File homeDir,
java.io.File tempDir,
java.lang.String encoding,
int bufferSize)
throws java.io.IOException
- Writes out the content of the file to the temporary file,
then deletes the existing configuration file (as specified
by the constructor parameter) and renames the temporary file
to the configuration file.
If the temporary file can't be written, or the configuration
file can't be replaced, a warning dialog is put up and the
configuration file remains unchanged.
- Throws:
java.io.IOException