|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.eclipse.rse.files.ui.resources.SystemSafeFileOutputStream
public class SystemSafeFileOutputStream
This class should be used when there's a file already in the destination and we don't want to lose its contents if a failure writing this stream happens. Basically, the new contents are written to a temporary location. If everything goes OK, it is moved to the right place. The user has the option to define the temporary location or it will be created in the default-temporary directory
Field Summary | |
---|---|
protected static java.lang.String |
BACKUP_EXTENSION
|
protected java.io.File |
destination
|
protected boolean |
failed
|
protected java.io.OutputStream |
output
|
protected java.io.File |
temp
|
Constructor Summary | |
---|---|
SystemSafeFileOutputStream(java.io.File file)
Constructor for SystemSafeFileOutputStream. |
|
SystemSafeFileOutputStream(java.lang.String destinationName)
Constructor for SystemSafeFileOutputStream. |
|
SystemSafeFileOutputStream(java.lang.String destinationPath,
java.lang.String tempPath)
Constructor for SystemSafeFileOutputStream. |
Method Summary | |
---|---|
void |
close()
Close the stream. |
protected void |
commit()
Commit the temporary file to the destination. |
protected void |
copy(java.io.File sourceFile,
java.io.File destinationFile)
Copy contents of one file to another. |
protected void |
createTempFile(java.lang.String tempPath)
Create the temporary file at the given path. |
void |
flush()
Flush the stream. |
java.lang.String |
getTempFilePath()
Get the temporary file path. |
protected void |
transferData(java.io.InputStream source,
java.io.OutputStream destination)
Transfers data from one stream to another. |
void |
write(int b)
Write an integer. |
Methods inherited from class java.io.OutputStream |
---|
write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.File destination
protected java.io.File temp
protected java.io.OutputStream output
protected boolean failed
protected static final java.lang.String BACKUP_EXTENSION
Constructor Detail |
---|
public SystemSafeFileOutputStream(java.io.File file) throws java.io.IOException
file
- the destination file.
java.io.IOException
public SystemSafeFileOutputStream(java.lang.String destinationName) throws java.io.IOException
destinationName
- the destination file name
java.io.IOException
public SystemSafeFileOutputStream(java.lang.String destinationPath, java.lang.String tempPath) throws java.io.IOException
destinationPath
- the destination file nametempPath
- the temporary file name
java.io.IOException
Method Detail |
---|
public void close() throws java.io.IOException
close
in class java.io.OutputStream
java.io.IOException
protected void commit() throws java.io.IOException
java.io.IOException
protected void copy(java.io.File sourceFile, java.io.File destinationFile) throws java.io.IOException
sourceFile
- the source filedestinationFile
- the destination file
java.io.IOException
protected void createTempFile(java.lang.String tempPath) throws java.io.IOException
tempPath
- the path of the temporary file to be created
java.io.IOException
public void flush() throws java.io.IOException
flush
in class java.io.OutputStream
java.io.IOException
public java.lang.String getTempFilePath()
protected void transferData(java.io.InputStream source, java.io.OutputStream destination) throws java.io.IOException
source
- streamdestination
- stream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the integer to write
java.io.IOException
|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |