public final class VirtualFile extends Object implements Serializable
VirtualFile instance gives no guarantees as to the presence or immutability of the referenced file or any of its
parent path elements.| Modifier and Type | Method and Description |
|---|---|
URI |
asDirectoryURI()
Get file's URI as a directory.
|
URL |
asDirectoryURL()
Get file's URL as a directory.
|
URI |
asFileURI()
Get file's URI as a file.
|
URL |
asFileURL()
Get file's URL as a file.
|
boolean |
delete()
Delete this virtual file
|
boolean |
equals(Object o)
Determine whether the given object is equal to this one.
|
boolean |
equals(VirtualFile o)
Determine whether the given object is equal to this one.
|
boolean |
exists()
Tests whether the underlying implementation file still exists.
|
Certificate[] |
getCertificates()
Get the
Certificates for the virtual file. |
VirtualFile |
getChild(String path)
Get a child virtual file.
|
List<VirtualFile> |
getChildren()
Get the children.
|
List<VirtualFile> |
getChildren(VirtualFileFilter filter)
Get the children
|
List<VirtualFile> |
getChildrenRecursively()
Get all the children recursively
|
List<VirtualFile> |
getChildrenRecursively(VirtualFileFilter filter)
Get all the children recursively
|
CodeSigner[] |
getCodeSigners()
Get the
CodeSigners for a the virtual file. |
long |
getLastModified()
When the file was last modified
|
String |
getLowerCaseName()
Deprecated.
should not be used anymore, as the code is case-sensitive from JBVFS-170
|
String |
getName()
Get the simple VF name (X.java)
|
VirtualFile |
getParent()
Get a
VirtualFile which represents the parent of this instance. |
List<VirtualFile> |
getParentFileList()
Get the all the parent files of this virtual file from this file to the root as a list.
|
VirtualFile[] |
getParentFiles()
Get the all the parent files of this virtual file from this file to the root.
|
String |
getPathName()
Get the absolute VFS full path name (/xxx/yyy/foo.ear/baz.jar/org/jboss/X.java)
|
String |
getPathNameRelativeTo(VirtualFile parent)
Get the path name relative to a parent virtual file.
|
File |
getPhysicalFile()
Get a physical file for this virtual file.
|
long |
getSize()
Get the size
|
int |
hashCode()
Get a hashcode for this virtual file.
|
boolean |
isDirectory()
Determine whether the named virtual file is a directory.
|
boolean |
isFile()
Determine whether the named virtual file is a plain file.
|
boolean |
isLeaf()
Deprecated.
use
isDirectory() or isFile() instead |
boolean |
isRoot()
Determines whether this virtual file represents a true root of a file system.
|
InputStream |
openStream()
Access the file contents.
|
String |
toString()
Get a human-readable (but non-canonical) representation of this virtual file.
|
URI |
toURI()
Get file's current URI.
|
URL |
toURL()
Get file's current URL.
|
void |
visit(VirtualFileVisitor visitor)
Visit the virtual file system
|
public String getName()
public String getLowerCaseName()
public String getPathName()
public String getPathNameRelativeTo(VirtualFile parent) throws IllegalArgumentException
IllegalArgumentException is thrown.parent - the parent virtual fileIllegalArgumentException - if the given virtual file is not a parent of this virtual filepublic long getLastModified()
public long getSize()
public boolean exists()
public boolean isRoot()
true if this represents a root.@Deprecated public boolean isLeaf()
true if a simple filepublic boolean isFile()
true if it is a plain file, false otherwisepublic boolean isDirectory()
true if it is a directory, false otherwisepublic InputStream openStream() throws IOException
IOException - for any error accessing the file systempublic boolean delete()
true if file was deletedpublic File getPhysicalFile() throws IOException
IOException - if an I/O error occurs while producing the physical filepublic VirtualFile getParent()
VirtualFile which represents the parent of this instance.null if there is no parentpublic VirtualFile[] getParentFiles()
public List<VirtualFile> getParentFileList()
public List<VirtualFile> getChildren()
public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
filter - to filter the childrenIOException - for any problem accessing the virtual file systemIllegalStateException - if the file is closed or it is a leaf nodepublic List<VirtualFile> getChildrenRecursively() throws IOException
This always uses
VisitorAttributes.RECURSEIOException - for any problem accessing the virtual file systemIllegalStateException - if the file is closedpublic List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
This always uses
VisitorAttributes.RECURSEfilter - to filter the childrenIOException - for any problem accessing the virtual file systemIllegalStateException - if the file is closed or it is a leaf nodepublic void visit(VirtualFileVisitor visitor) throws IOException
visitor - the visitorIOException - for any problem accessing the virtual file systemIllegalArgumentException - if the visitor is nullIllegalStateException - if the file is closedpublic VirtualFile getChild(String path)
path - the pathIllegalArgumentException - if the path is nullpublic URL toURL() throws MalformedURLException
MalformedURLException - if the URL is somehow malformedasDirectoryURL(),
asFileURL()public URI toURI() throws URISyntaxException
URISyntaxException - if the URI is somehow malformedasDirectoryURI(),
asFileURI()public URL asDirectoryURL() throws MalformedURLException
"/" character.MalformedURLException - if the URL is somehow malformedpublic URI asDirectoryURI() throws URISyntaxException
"/" character.URISyntaxException - if the URI is somehow malformedpublic URL asFileURL() throws MalformedURLException
"/" character unless this VirtualFile
represents a root.MalformedURLException - if the URL is somehow malformedpublic URI asFileURI() throws URISyntaxException
"/" character unless this VirtualFile
represents a root.URISyntaxException - if the URI is somehow malformedpublic CodeSigner[] getCodeSigners()
CodeSigners for a the virtual file.CodeSigners for the virtual file, or null if not signedpublic Certificate[] getCertificates()
Certificates for the virtual file. Simply extracts the certificate entries from
the code signers array.null if not signedpublic String toString()
public boolean equals(Object o)
VirtualFile
from the same VFS instance with the same name.public boolean equals(VirtualFile o)
VirtualFile
from the same VFS instance with the same name.o - the other virtual filetrue if they are equalCopyright © 2012 JBoss by Red Hat. All Rights Reserved.