Information about a file in a FileTree.
Type | Name and description |
---|---|
void |
copyTo(OutputStream outstr) Copies the content of this file to an output stream. |
boolean |
copyTo(File target) Copies this file to the given target file. |
File |
getFile() Returns the file being visited. |
long |
getLastModified() Returns the last modified time of this file. |
int |
getMode() Returns the Unix permissions of this file, e.g. |
String |
getName() Returns the base name of this file. |
String |
getPath() Returns the path of this file, relative to the root of the containing file tree. |
RelativePath |
getRelativePath() Returns the path of this file, relative to the root of the containing file tree. |
long |
getSize() Returns the size of this file. |
boolean |
isDirectory() Returns true if this element is a directory, or false if this element is a regular file. |
InputStream |
open() Opens this file as an input stream. |
Copies the content of this file to an output stream. Generally, calling this method is more performant than
calling new FileInputStream(getFile())
.
outstr
- The output stream to write to. The caller is responsible for closing this stream.Copies this file to the given target file. Does not copy the file if the target is already a copy of this file.
target
- the target file.Returns the file being visited.
Returns the last modified time of this file. Generally, calling this method is more performant than calling
getFile().lastModified()
Returns the Unix permissions of this file, e.g. 0644
.
Returns the base name of this file.
Returns the path of this file, relative to the root of the containing file tree. Always uses '/' as the hierarchy
separator, regardless of platform file separator. Same as calling getRelativePath().getPathString()
.
Returns the path of this file, relative to the root of the containing file tree.
Returns the size of this file. Generally, calling this method is more performant than calling getFile().length()
.
Returns true if this element is a directory, or false if this element is a regular file.
Opens this file as an input stream. Generally, calling this method is more performant than calling new
FileInputStream(getFile())
.