|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileSystemProvider
Specifies the contract between FileSystem abstarction and its concrete delegates.
| Method Summary | |
|---|---|
boolean |
canRead(String path)
Checks if the application is allowed to read given file or directory. |
boolean |
canWrite(String path)
Checks if the application is allowed to write given file or directory. |
boolean |
checkPathChars(String path)
Returns true if the given path contains acceptable characters. |
boolean |
createNewFile(String path)
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. |
void |
delete(String path)
Deletes a file or directory. |
boolean |
exists(String path)
Checks if the given file or directory exists. |
InputStream |
getInputStream(String path)
Opens an input stream for reading a file. |
String |
getName()
Returns the name of the provider. |
OutputStream |
getOutputStream(String path,
boolean append)
Opens an output stream for writing to file. |
RandomAccessFile |
getRandomAccess(String path,
String mode)
Returns a RandomAccess interface implementation for accessing the file at
arbitrary positions. |
URL |
getResource(String path)
Returns an URL to the resource. |
boolean |
isDirectory(String path)
Checks if the given pathname points to a directory. |
boolean |
isFile(String path)
Checks if the given pathname points to an ordinary file. |
boolean |
isReadOnly()
Returns true if the provider is readonly. |
long |
lastModified(String path)
Returns the time of the last modificaion of the specified file. |
long |
length(String path)
Returns the size of the specified file. |
Set<String> |
list(String dir)
Lists the files and directories inside a directory. |
void |
mkdirs(String path)
Creates a directory, and all necceray parent directories. |
void |
rename(String from,
String to)
Atomically renames a file or directory. |
| Method Detail |
|---|
String getName()
boolean isReadOnly()
true if the provider is readonly.
true if the provider is readonly.boolean checkPathChars(String path)
true if the given path contains acceptable characters.
path - the path.
true if the given path contains acceptable characters.boolean exists(String path)
path - the path.
true if the given file or directory exists.boolean isFile(String path)
path - the path
true if the given pathname points to a directory.boolean isDirectory(String path)
path - the path
true if the given pathname points to a directory.boolean canRead(String path)
path - the path.
true if the application is allowed to read given
file or directory.boolean canWrite(String path)
path - the path.
true if the application is allowed to write given
file or directory.
Set<String> list(String dir)
throws IOException
dir - the directory.
IOException - if dir does not exist
or is not a directory.
boolean createNewFile(String path)
throws IOException,
UnsupportedCharactersInFilePathException
The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.
path - the pathname of the file to create.
true if the named file does not exist and was
successfully created; false if the named file
already exists.
UnsupportedCharactersInFilePathException - if the given path contains characters
incompatible with underlying filesystem.
IOException - if the operation fails.
void mkdirs(String path)
throws IOException,
UnsupportedCharactersInFilePathException
path - the path.
UnsupportedCharactersInFilePathException - if the given path contains characters
incompatible with underlying filesystem.
IOException - if the operation fails.
void delete(String path)
throws IOException
Directories must be empty when being deleted.
path - the path.
IOException - if the operation fails.
void rename(String from,
String to)
throws IOException,
UnsupportedCharactersInFilePathException
from - source path.to - destination path.
UnsupportedCharactersInFilePathException - if the given destination path contains
characters incompatible with underlying filesystem.
IOException - if the operation fails.InputStream getInputStream(String path)
path - the path.
OutputStream getOutputStream(String path,
boolean append)
path - the path.append - true to append, false to truncate.
RandomAccessFile getRandomAccess(String path,
String mode)
RandomAccess interface implementation for accessing the file at
arbitrary positions.
path - the abstract pathname.mode - the string which defines the opening mode for this random access file,
the form of this string is equal to the mode parameter in
java.io.RandomAccessFile constructor.
null
if the operation is not supported.
URL getResource(String path)
throws MalformedURLException
path - the abstract pathname.
MalformedURLException - if the path contains invalid characters.long lastModified(String path)
The time of the modification is returned as the number of milliseconds sice the epoch (Jan 1 1970), or -1L if the feature is not supported.
path - the path.
long length(String path)
path - the path.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||