Class SafeFileOutputStream
java.lang.Object
java.io.OutputStream
com.inductiveautomation.ignition.common.util.SafeFileOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
A FileOutputStream that implements a two-stage write process, and additionaly copies any existing file to a backup location. This ensures that no matter what (software or hardware failures), there is always a valid (non-corrupt) copy of the destination file. More formally, the logic is as follows.
- As write() is called on the SafeFileOutputStream instance, information is written to a temporary file, obtained by File.createTempFile().
- When close() is called, the destination file (if it exists), is renamed to the backup file
- Then the temp file is renamed to the destination file
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.io.OutputStreamnullOutputStream
- 
Constructor Details- 
SafeFileOutputStream- Throws:
- IOException
 
 
- 
- 
Method Details- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- OutputStream
- Throws:
- IOException
 
- 
flush- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException
 
- 
write- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
- 
write- Overrides:
- writein class- OutputStream
- Throws:
- IOException
 
- 
write- Specified by:
- writein class- OutputStream
- Throws:
- IOException
 
 
-