com.gubutech.xload
Interface XloadFileRename
- All Known Implementing Classes:
- XloadCounterFileRename, XloadIncrementalFileRename
- public interface XloadFileRename
This interface allows programmers to create their own implementation of a file renaming policy. The File
object argument
to the rename(File)
method is the File
abstraction of a file to be uploaded. It uses the files remote name
(see XloadFile
for
an explanation of remote name
) as its name and some target directory. How this will be renamed (if at all) is up to the implementor. See rename(File)
for a more detailed explanation of the contract for what is supplied and what is returned in the rename(File)
method.
- Since:
- 1.0
- See Also:
XloadCounterFileRename
,
XloadIncrementalFileRename
Method Summary |
java.io.File |
rename(java.io.File file)
Names a file to a unique name within the appropriate directory. |
rename
public java.io.File rename(java.io.File file)
- Names a file to a unique name within the appropriate directory. This method should be thread safe and create files atomically
which are used as markers before any bytes are written to them. This method expects a
File
object as argument that
represents a file that has not been created yet. It should then via some policy attempt to create an empty file on the file
system. It then returns this file as a File
object even if this file could not be created for some reason.
Any IOException
objects that are thrown should be handled and ignored as these will be handled later in the
data writing process by Xload. Only the file name should be renamed and the parent directory should be left unaltered.
- Parameters:
file
- File
object representing the initial file to rename if necessary.
- Returns:
File
object that has been created and exists with a unique name within a directory.- Since:
- 1.0