public interface Resource
| Modifier and Type | Method and Description |
|---|---|
Resource |
copy(Resource destination)
Copy a file/directory to destination;
|
boolean |
delete()
Deletes the file resource.
|
boolean |
exists()
Check if this file resource exists.
|
java.lang.String |
getAbsolutePath()
Returns the absolute file resource string of this
|
java.lang.String |
getName()
Returns the name of this file resource
|
Resource |
getParent()
Returns the file resource of this parent, or
null if this file resource does not name a parent directory. |
boolean |
isDirectory()
Check if the file denoted is a directory.
|
boolean |
isLeaf()
Return true if this file resource is a file, not a directory.
|
boolean |
isSymbolicLink()
Return true if this resource is a symbolic link.
|
long |
lastAccessed()
Returns the last accessed time of the file or directory
|
long |
lastModified()
Returns the last modified time of the file or directory
|
java.util.List<Resource> |
list()
Returns a list of file resources denoting the files in the
directory denoted by this file resource.
|
java.util.List<Resource> |
list(ResourceFilter filter)
Returns a list of path names denoting the files in the
directory denoted by this file resource filtered by argument.
|
java.util.List<Resource> |
listRoots()
List the available filesystem roots.
|
boolean |
mkdirs()
Creates the directory named by this file resource, including any
necessary but nonexistent parent directories.
|
void |
move(Resource target)
Move a file/directory.
|
Resource |
newInstance(java.lang.String path)
Return a new instance of FileResource with String as argument
|
java.io.InputStream |
read()
InputStream from this FileResource
|
<A extends java.nio.file.attribute.BasicFileAttributes> |
readAttributes(java.lang.Class<A> type,
java.nio.file.LinkOption... options) |
Resource |
readSymbolicLink()
If the Resource system support symbolic links and
this is a symbolic link, return the link target.
|
java.util.List<Resource> |
resolve(Resource cwd)
Resolve a file that might contain (~,*,?) based on this instance and
a given current working directory as argument.
|
void |
setLastAccessed(long time)
Sets the last-accessed time of the file or directory named by this abstract pathname.
|
boolean |
setLastModified(long time)
Sets the last-modified time of the file or directory named by this abstract pathname.
|
java.io.OutputStream |
write(boolean append)
OutputStream that will be written to this FileResource
|
java.lang.String getName()
java.lang.String getAbsolutePath()
boolean isLeaf()
boolean isDirectory()
boolean isSymbolicLink()
Resource readSymbolicLink() throws java.io.IOException
java.io.IOExceptionboolean exists()
boolean mkdirs()
boolean delete()
void move(Resource target) throws java.io.IOException
target - the target file/directory.java.io.IOExceptionResource getParent()
null if this file resource does not name a parent directory.java.util.List<Resource> list()
java.util.List<Resource> list(ResourceFilter filter)
filter - filterjava.util.List<Resource> listRoots()
java.util.List<Resource> resolve(Resource cwd)
cwd - current working directoryjava.io.OutputStream write(boolean append)
throws java.io.FileNotFoundException
append - java.io.FileNotFoundException - if file cannot be written to or is !isLeaf()java.io.InputStream read()
throws java.io.FileNotFoundException
java.io.FileNotFoundException - if the file doesn't exist<A extends java.nio.file.attribute.BasicFileAttributes> A readAttributes(java.lang.Class<A> type,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionResource newInstance(java.lang.String path)
path - argumentResource copy(Resource destination) throws java.io.IOException
destination - local that you want copy filejava.io.IOExceptionboolean setLastModified(long time)
time - The new last-modified time, measured in millisecondslong lastModified()
void setLastAccessed(long time)
throws java.io.IOException
time - The new last-accessed time, measured in millisecondsjava.io.IOExceptionlong lastAccessed()
throws java.io.IOException
java.io.IOException