|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcorelib.io.files.FileSystem
public class FileSystem
This class provides methods to manage the file systems and it's elements (files and directories).
| Constructor Summary | |
|---|---|
FileSystem()
|
|
| Method Summary | |
|---|---|
static boolean |
contains(java.lang.String parentPath,
java.lang.String childPath)
Checks if a path is contained into another path. |
static void |
copyFile(java.io.InputStream is,
java.lang.String destinationFile)
|
static void |
copyFile(java.lang.String sourceFile,
java.lang.String destinationFile)
Copies the source file on the destination file. |
static void |
copyFile(java.lang.String sourceFile,
java.lang.String destinationFile,
boolean overwrite)
Copies the source file on the destination file. |
static void |
delete(java.lang.String filename)
|
static void |
delTree(java.lang.String folder)
|
static java.lang.String |
getCurrentWorkingDirectory()
Returns the current working directory as string instance. |
static long |
getLastModifiedTime(java.lang.String pathName)
Returns the last modified time for the considered path. |
static boolean |
isExisting(java.lang.String pathName)
Check a file (or directory) presence on the FileSystem. |
static java.lang.String[] |
list(java.lang.String folderName)
|
static Folder |
mkdir(java.lang.String pathName)
Constructs a new folder on disk. |
static Folder |
mkdirs(java.lang.String pathName)
Constructs a new folder on disk. |
static void |
moveOrRename(java.lang.String sourceFile,
java.lang.String destinationFile)
Moves or renames the considered file. |
static void |
rmdir(java.lang.String pathName,
boolean recursive)
Remove the specified directory. |
static boolean |
rmFromSnapshot(DirectorySnapshot snapshot)
Delete elements in a directories structure, only if this element is present in the considered directory snapshot. |
static void |
touch(java.lang.String pathName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileSystem()
| Method Detail |
|---|
public static boolean isExisting(java.lang.String pathName)
pathName - Specify the path to check existance.
public static long getLastModifiedTime(java.lang.String pathName)
pathName - The path.
public static Folder mkdir(java.lang.String pathName)
throws java.io.IOException
pathName - The new folder path name.
Folder instance.
java.io.IOException - Thrown if the method cannot create the specified folder.
public static Folder mkdirs(java.lang.String pathName)
throws java.io.IOException
pathName - The new folder path name.
Folder instance.
java.io.IOException - Thrown if the method cannot create the specified folder.
public static void rmdir(java.lang.String pathName,
boolean recursive)
throws java.io.IOException
Remove the specified directory. If the directory is not empty and the recursive value equals true, all files and subdirectories are removed. Otherwise, an IOException will be thrown.
Important note: removed files and directories are not moved into the trash. There are definitivly removed. Please, use this method with caution.
pathName - The path of the directory to remove.recursive - Pass true value if you want recursivly removed all containing files and subdirectories.
Pass false otherwize.
java.io.IOException - Thrown if the method can't remove the directory structure.
public static boolean rmFromSnapshot(DirectorySnapshot snapshot)
throws DirectorySnapshotException
snapshot - The directory snapshot used to remove files and directories.
java.lang.NullPointerException - Thrown if the specified snapshot is null.
DirectorySnapshotException - Thrown if the specified snapshot cannot be used.
public static void moveOrRename(java.lang.String sourceFile,
java.lang.String destinationFile)
throws java.io.IOException
sourceFile - The originaly file name.destinationFile - The new file name.
java.io.IOException - Thrown if this methods cannot change the file name.
public static void copyFile(java.lang.String sourceFile,
java.lang.String destinationFile)
throws java.io.IOException
sourceFile - The name of the source file (relative or absolute path names are accepted)destinationFile - The name of the destination file (relative or absolute path names are accepted)
java.io.IOException - Thrown if the file cannot be copied or if the file exists.
public static void copyFile(java.lang.String sourceFile,
java.lang.String destinationFile,
boolean overwrite)
throws java.io.IOException
sourceFile - The name of the source file (relative or absolute path names are accepted)destinationFile - The name of the destination file (relative or absolute path names are accepted)overwrite - Indicates if the destination file can be overwritten (true) or not (false), if file exists.
java.io.IOException - Thrown if the file cannot be copied or if the file exists and cannot be overwritten.
public static void copyFile(java.io.InputStream is,
java.lang.String destinationFile)
throws java.io.IOException
java.io.IOException
public static void delete(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic static void delTree(java.lang.String folder)
public static void touch(java.lang.String pathName)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String[] list(java.lang.String folderName)
public static boolean contains(java.lang.String parentPath,
java.lang.String childPath)
throws java.io.IOException
parentPath - The parent folder path.childPath - The child path to check.
childPath is contained into parentPath
java.io.IOException - Thrown if contains method cannot check containment.
java.lang.NullPointerException - Thrown if parentPath or childPath are null.public static java.lang.String getCurrentWorkingDirectory()
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||