|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ebmwebsourcing.easycommons.io.FileSystemHelper
public final class FileSystemHelper
| Method Summary | |
|---|---|
static void |
cleanDirectory(java.io.File directory)
Cleans a directory without deleting it. |
static java.io.File |
createTempDir()
|
static java.io.File |
createTempDir(java.io.File parentDir,
java.lang.String prefix)
|
static java.io.File |
createTempDir(java.lang.String prefix)
|
static void |
forceDelete(java.io.File file)
Deletes a file. |
static java.lang.String |
getRelativePath(java.lang.String source,
java.lang.String target)
Return relative path. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.io.File createTempDir()
throws java.io.IOException
java.io.IOException
public static java.io.File createTempDir(java.lang.String prefix)
throws java.io.IOException
java.io.IOException
public static java.io.File createTempDir(java.io.File parentDir,
java.lang.String prefix)
throws java.io.IOException
java.io.IOException
public static void cleanDirectory(java.io.File directory)
throws java.io.IOException
directory - directory to clean
java.io.IOException - in case cleaning is unsuccessful
public static void forceDelete(java.io.File file)
throws java.io.IOException
The difference between File.delete() and this method are:
file - file or directory to delete, must not be null
java.lang.NullPointerException - if the directory is null
java.io.IOException - in case deletion is unsuccessful
public static java.lang.String getRelativePath(java.lang.String source,
java.lang.String target)
WARNING: Folder path must finished with the character:
File.separator
| source | target | relative path |
| /root/dir1/dir2/ | /root/dir1/ | ../ |
| /root/ | /root/dir1/dir2/ | dir1/dir2/ |
| /root/dir1/dir2/ | /root/test.xml | ../../test.xml |
source - path of the source foldertarget - path of the target folder/file
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||