| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
file |
| Constructor and Description |
|---|
FileResource(java.io.File file) |
FileResource(java.lang.String file) |
| 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.io.File |
getFile() |
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.lang.String |
toString() |
java.io.OutputStream |
write(boolean append)
OutputStream that will be written to this FileResource
|
public FileResource(java.io.File file)
public FileResource(java.lang.String file)
public java.lang.String getName()
Resourcepublic java.lang.String getAbsolutePath()
ResourcegetAbsolutePath in interface Resourcepublic boolean isLeaf()
Resourcepublic boolean isDirectory()
ResourceisDirectory in interface Resourcepublic boolean isSymbolicLink()
ResourceisSymbolicLink in interface Resourcepublic Resource readSymbolicLink() throws java.io.IOException
ResourcereadSymbolicLink in interface Resourcejava.io.IOExceptionpublic boolean exists()
Resourcepublic boolean mkdirs()
Resourcepublic boolean delete()
Resourcepublic void move(Resource target) throws java.io.IOException
Resourcepublic Resource getParent()
Resourcenull if this file resource does not name a parent directory.public java.util.List<Resource> list()
Resourcepublic java.util.List<Resource> list(ResourceFilter filter)
Resourcepublic java.util.List<Resource> listRoots()
Resourcepublic java.util.List<Resource> resolve(Resource cwd)
Resourcepublic java.io.InputStream read()
throws java.io.FileNotFoundException
Resourcepublic <A extends java.nio.file.attribute.BasicFileAttributes> A readAttributes(java.lang.Class<A> type,
java.nio.file.LinkOption... options)
throws java.io.IOException
readAttributes in interface Resourcejava.io.IOExceptionpublic java.io.OutputStream write(boolean append)
throws java.io.FileNotFoundException
Resourcepublic java.lang.String toString()
toString in class java.lang.Objectpublic Resource newInstance(java.lang.String path)
ResourcenewInstance in interface Resourcepath - argumentpublic Resource copy(Resource destination) throws java.io.IOException
Resourcepublic boolean setLastModified(long time)
ResourcesetLastModified in interface Resourcetime - The new last-modified time, measured in millisecondspublic long lastModified()
ResourcelastModified in interface Resourcepublic void setLastAccessed(long time)
throws java.io.IOException
ResourcesetLastAccessed in interface Resourcetime - The new last-accessed time, measured in millisecondsjava.io.IOExceptionpublic long lastAccessed()
throws java.io.IOException
ResourcelastAccessed in interface Resourcejava.io.IOExceptionpublic java.io.File getFile()