public interface VirtualFile
File
and the
FileObject
method signatures to minimize confusion. All of the
methods on this interface can throw
RuntimeIOException
's when invoked. Since these are
RuntimeException
's you are not required to handle them. URL's can be
represented in two ways: 1) human readable 2) escaped. For example the URL
"file:///c:/program files" would be human readable and the URL
"file:///program%20files" would be escaped. Depending on what the URL is used
for one of both formats sometimes won't work. The native command line
typically accepts human readable form, while ShellCommand's expect the
escaped form. Most properties on this class are available in both formats.Modifier and Type | Method and Description |
---|---|
boolean |
exists()
Returns whether or not the resource exists.
|
java.lang.String |
getAbsolutePath()
Return the absolute path to the file.
|
java.lang.String |
getBaseName()
Get the base name of the file without the extension in human readable
form.
|
java.lang.String |
getExtension()
Get the file extension.
|
org.apache.commons.vfs.FileObject |
getFileObject()
Get the Apache commons VFS
FileObject for this VirtualFile. |
java.io.File |
getLocalFile()
Get the
File for this VirtualFile. |
java.lang.String |
getName()
Get the name of the file in human readable form including extension.
|
java.lang.String |
getNameEscaped()
Get the escaped name of the file including extension.
|
VirtualFile |
getParentFile()
Get the parent file that has this file as a child.
|
long |
getSize()
Determines the size of the file, in bytes.
|
java.lang.String |
getUrl()
Returns the full URL in human readable form.
|
java.lang.String |
getUrlEscaped()
Returns the escaped full URL.
|
boolean |
hasParent()
Return true iff this is not a root URL.
|
boolean |
isDirectory()
Returns true iff this VirtualFile is a directory.
|
boolean |
isFile()
Returns true iff the resource if a file.
|
boolean |
isHidden()
Returns true iff the resource is marked as hidden.
|
boolean |
isLocal()
Returns true iff the resource is a
File on the local file system. |
VirtualFile[] |
listFiles()
List the children of this VirtualFile in random order.
|
VirtualFile |
resolveFile(java.lang.String relative)
Resolve a child.
|
boolean isDirectory()
boolean exists()
boolean isFile()
boolean isHidden()
boolean isLocal()
File
on the local file system.java.lang.String getUrlEscaped()
java.lang.String getUrl()
java.lang.String getAbsolutePath()
java.lang.String getBaseName()
java.lang.String getName()
java.lang.String getNameEscaped()
java.lang.String getExtension()
java.io.File getLocalFile()
File
for this VirtualFile. Use isLocal() to check if the
VirtualFile is a File on the local file system, otherwise the result of
this method is undefined.VirtualFile[] listFiles()
boolean hasParent()
VirtualFile getParentFile()
org.apache.commons.vfs.FileObject getFileObject()
FileObject
for this VirtualFile.VirtualFile resolveFile(java.lang.String relative)
relative
- Relative path to the child.long getSize()