|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileSystem
Interface for a file system for managing files and directories.
| Method Summary | |
|---|---|
void |
add(FileSystemEntry entry)
Add the specified file system entry (file or directory) to this file system |
boolean |
delete(String path)
Delete the file or directory specified by the path. |
boolean |
exists(String path)
Return true if there exists a file or directory at the specified path |
String |
formatDirectoryListing(FileSystemEntry fileSystemEntry)
Return the formatted directory listing entry for the file represented by the specified FileSystemEntry |
FileSystemEntry |
getEntry(String path)
Returns the FileSystemEntry object representing the file system entry at the specified path, or null if the path does not specify an existing file or directory within this file system. |
String |
getParent(String path)
Return the parent path of the specified path. |
boolean |
isAbsolute(String path)
Return true if the specified path designates an absolute file path. |
boolean |
isDirectory(String path)
Return true if the specified path designates an existing directory, false otherwise |
boolean |
isFile(String path)
Return true if the specified path designates an existing file, false otherwise |
List |
listFiles(String path)
Return the List of FileSystemEntry objects for the files in the specified directory path. |
List |
listNames(String path)
Return the List of filenames in the specified directory path. |
String |
path(String path1,
String path2)
Build a path from the two path components. |
void |
rename(String fromPath,
String toPath)
Rename the file or directory. |
| Method Detail |
|---|
void add(FileSystemEntry entry)
entry - - the FileSystemEntry to addList listFiles(String path)
path - - the path of the directory whose contents should be returned
List listNames(String path)
path - - the path of the directory whose contents should be returned
AssertionError - - if path is nullboolean delete(String path)
path - - the path of the file or directory to delete
AssertionError - - if path is null
void rename(String fromPath,
String toPath)
fromPath - - the source (old) path + filenametoPath - - the target (new) path + filename
AssertionError - - if fromPath or toPath is null
FileSystemException - - if the rename fails.String formatDirectoryListing(FileSystemEntry fileSystemEntry)
fileSystemEntry - - the FileSystemEntry representing the file or directory entry to be formatted
boolean exists(String path)
path - - the path
AssertionError - - if path is nullboolean isDirectory(String path)
path - - the path
AssertionError - - if path is nullboolean isFile(String path)
path - - the path
AssertionError - - if path is nullboolean isAbsolute(String path)
path - - the path
AssertionError - - if path is null
String path(String path1,
String path2)
path1 - - the first path component may be null or emptypath2 - - the second path component may be null or empty
FileSystemEntry getEntry(String path)
path - - the path of the file or directory within this file system
String getParent(String path)
path specifies a filename,
then this method returns the path of the directory containing that file. If path
specifies a directory, the this method returns its parent directory. If path is
empty or does not have a parent component, then return an empty string.
All path separators in the returned path are converted to the system-dependent separator character.
path - - the path
path has no parent
AssertionError - - if path is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||