edu.rice.cs.util
Interface FileOps.FileSaver

All Known Implementing Classes:
FileOps.DefaultFileSaver
Enclosing class:
FileOps

public static interface FileOps.FileSaver


Method Summary
 void backupDone()
          This method is called to tell the file saver that a backup was successfully made.
 boolean continueWhenTempFileCreationFails()
          This method specifies if the saving process should continue trying to save the file if the temp file that is written initially cannot be created.
 File getBackupFile()
          This method tells what to name the backup file, if a backup is made.
 File getTargetFile()
          This method specifies the file for saving.
 void saveTo(OutputStream os)
          This method actually writes info to a file.
 boolean shouldBackup()
          This method indicates whether or not a backup of the file should be made.
 

Method Detail

getBackupFile

File getBackupFile()
                   throws IOException
This method tells what to name the backup file, if a backup is made. It may depend on getTargetFile(), so it can throw an IOException.

Throws:
IOException

shouldBackup

boolean shouldBackup()
                     throws IOException
This method indicates whether or not a backup of the file should be made. It may depend on getTargetFile(), so it can throw an IOException.

Throws:
IOException

continueWhenTempFileCreationFails

boolean continueWhenTempFileCreationFails()
This method specifies if the saving process should continue trying to save the file if the temp file that is written initially cannot be created. Continue saving in this case is dangerous because the original file may be lost if saving fails.


backupDone

void backupDone()
This method is called to tell the file saver that a backup was successfully made.


saveTo

void saveTo(OutputStream os)
            throws IOException
This method actually writes info to a file. NOTE: It is important that this method write to the stream it is passed, not the target file. If you write directly to the target file, the target file will be destroyed if saving fails. Also, it is important that when saving fails this method throw an IOException

Throws:
IOException - when saving fails for any reason

getTargetFile

File getTargetFile()
                   throws IOException
This method specifies the file for saving. It should return the canonical name of the file, resolving symlinks. Otherwise, the saver cannot deal correctly with symlinks. Resolving symlinks may cause an IOException, so this method declares that it may throw an IOException.

Throws:
IOException