public class SafeFileOutputStream
extends java.io.OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
EXTENSION |
protected boolean |
failed |
protected java.io.OutputStream |
output |
protected java.io.File |
target |
protected java.io.File |
temp |
| Constructor and Description |
|---|
SafeFileOutputStream(java.io.File file)
Creates an output stream on a file at the given location
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
commit() |
protected void |
copy(java.io.File sourceFile,
java.io.File destinationFile) |
void |
flush() |
java.lang.String |
getTempFilePath() |
protected void |
transferStreams(java.io.InputStream source,
java.io.OutputStream destination) |
void |
write(int b) |
protected java.io.File temp
protected java.io.File target
protected java.io.OutputStream output
protected boolean failed
protected static final java.lang.String EXTENSION
public SafeFileOutputStream(java.io.File file)
throws java.io.IOException
file - The file to be written tojava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionprotected void commit()
throws java.io.IOException
java.io.IOExceptionprotected void copy(java.io.File sourceFile,
java.io.File destinationFile)
throws java.io.IOException
java.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic java.lang.String getTempFilePath()
protected void transferStreams(java.io.InputStream source,
java.io.OutputStream destination)
throws java.io.IOException
java.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException