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 Summary
Constructors - 
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream 
- 
Constructor Details
- 
SafeFileOutputStream
- Throws:
 IOException
 
 - 
 - 
Method Details
- 
close
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Overrides:
 closein classOutputStream- Throws:
 IOException
 - 
flush
- Specified by:
 flushin interfaceFlushable- Overrides:
 flushin classOutputStream- Throws:
 IOException
 - 
write
- Overrides:
 writein classOutputStream- Throws:
 IOException
 - 
write
- Overrides:
 writein classOutputStream- Throws:
 IOException
 - 
write
- Specified by:
 writein classOutputStream- Throws:
 IOException
 
 -