Package edu.harvard.hul.ois.jhove
Class ConfigWriter
java.lang.Object
edu.harvard.hul.ois.jhove.ConfigWriter
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidwriteFile(List<ModuleInfo> modules, List<String[]> handlers, File homeDir, File tempDir, 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.
-
Constructor Details
-
ConfigWriter
Constructor. Creates a temporary file for writing and creates an OutputStreamWriter to write to it. If there is already a file located byfile, it will not be replaced or overwritten untilwriteFilehas 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:
IOException
-
-
Method Details
-
writeFile
public void writeFile(List<ModuleInfo> modules, List<String[]> handlers, File homeDir, File tempDir, 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. 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.
-