|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gubutech.xload.XloadCounterFileRename
Class that implements a rename policy that safely renames files to an arbitrary number that increments sequentially by 1.
The starting value by default is 10347
but this can be set to a desired value by using the appropriate constructor.
This class will preserve file extensions and therefore will allow two or more files to exist in the same directory with the same
number but with different extensions making them unique within the directory.
This class will attempt to rename every file to the appropriate name. This means that if there are many targets for a file upload
then each file deployment
will be given a different file name.
If for some reason a naming clash occurs then this policy will just increment the arbitrary number by 1 and attempt to rename again.
Please note that this method is not guaranteed to produce sequential numbers for files when the files are listed in chronological order.
Constructor Summary | |
XloadCounterFileRename()
Creates an instance of XloadCounterFileRename using a default starting value of 10347 for the arbitrary number. |
|
XloadCounterFileRename(int sv)
Creates an instance of XloadCounterFileRename with a given starting value for the arbitrary number. |
Method Summary | |
java.io.File |
rename(java.io.File file)
Performs the actual rename of the file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XloadCounterFileRename(int sv)
XloadCounterFileRename
with a given starting value for the arbitrary number.
sv
- Starting value number.public XloadCounterFileRename()
XloadCounterFileRename
using a default starting value of 10347
for the arbitrary number.
Method Detail |
public java.io.File rename(java.io.File file)
file
argument name to the correct arbitrary
number(including original extension) and then attempt to create an empty file on disk safely as a marker. This is then used
to write the actual bytes of data to. If Xload cannot create the empty marker file then the arbitrary number is increased by 1
and the process is repeated until a marker file is created. e.g.
file name - name.txt
renamed to - 10347.txt
rename
in interface XloadFileRename
file
- Initial file object that will be renamed and created.
java.lang.SecurityException
- Thrown if there is a problem accessing files on the file system with regard to permissions set by the SecurityManager
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |