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.
|
String |
getAbsolutePath()
Returns the absolute file resource string of this
|
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
|
List<Resource> |
list()
Returns a list of file resources denoting the files in the
directory denoted by this file resource.
|
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.
|
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(String path)
Return a new instance of FileResource with String as argument
|
InputStream |
read()
InputStream from this FileResource
|
<A extends BasicFileAttributes> |
readAttributes(Class<A> type,
LinkOption... options) |
Resource |
readSymbolicLink()
If the Resource system support symbolic links and
this is a symbolic link, return the link target.
|
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.
|
OutputStream |
write(boolean append)
OutputStream that will be written to this FileResource
|
String getName()
String getAbsolutePath()
boolean isLeaf()
boolean isDirectory()
boolean isSymbolicLink()
Resource readSymbolicLink() throws IOException
IOException
boolean exists()
boolean mkdirs()
boolean delete()
void move(Resource target) throws IOException
target
- the target file/directory.IOException
Resource getParent()
null
if this file resource does not name a parent directory.List<Resource> list()
List<Resource> list(ResourceFilter filter)
filter
- filterList<Resource> listRoots()
List<Resource> resolve(Resource cwd)
cwd
- current working directoryOutputStream write(boolean append) throws FileNotFoundException
append
- FileNotFoundException
- if file cannot be written to or is !isLeaf()InputStream read() throws FileNotFoundException
FileNotFoundException
- if the file doesn't exist<A extends BasicFileAttributes> A readAttributes(Class<A> type, LinkOption... options) throws IOException
IOException
Resource newInstance(String path)
path
- argumentResource copy(Resource destination) throws IOException
destination
- local that you want copy fileIOException
boolean setLastModified(long time)
time
- The new last-modified time, measured in millisecondslong lastModified()
void setLastAccessed(long time) throws IOException
time
- The new last-accessed time, measured in millisecondsIOException
long lastAccessed() throws IOException
IOException
Copyright © 2022 JBoss by Red Hat. All rights reserved.