|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fcrepo.server.journal.helpers.FileMovingUtil
public class FileMovingUtil
Provides a workaround to the fact that
java.io.File.renameTo(java.io.File) doesn't work across NFS file
systems.
This code is taken from a workaround provided on the Sun Developer Network Bug Database (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4073756), by mailto:morgan.sziraki@cartesian.co.uk
The code is modified to protect against a situation where
To avoid this, we create the new file with a modified filename (prefixed by an underscore '_'). When the copying is complete, we rename the file to the desired name. This rename is within a directory, and therefore does not extend across NFS filesystem boundaries, so it should work!
Modify again to make sure that neither the destination file nor the temp file exist - throw an exception if they do. We can't rename on top of an existing file.
| Method Summary | |
|---|---|
static void |
move(File fromFile,
File toFile)
Move a File |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final void move(File fromFile,
File toFile)
throws IOException
Move a File
The renameTo method does not allow action across NFS mounted filesystems. This method is the workaround.
fromFile - The existing FiletoFile - The new File
IOException - if any problems occur
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||