|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.virtual.VirtualFile
public class VirtualFile
A virtual file as seen by the user
Constructor Summary | |
---|---|
VirtualFile(VirtualFileHandler handler)
Create a new VirtualFile. |
Method Summary | |
---|---|
protected void |
checkStreams()
Check if streams set exist. |
void |
cleanup()
Do file cleanup. |
void |
close()
Close the file resources (stream, etc.) |
void |
closeStreams()
Close the streams |
boolean |
delete()
Delete this virtual file |
boolean |
delete(int gracePeriod)
Delete this virtual file |
boolean |
equals(Object obj)
|
boolean |
exists()
Tests whether the underlying implementation file still exists. |
VirtualFile |
findChild(String path)
Deprecated. use getChild, and handle null if not found |
VirtualFile |
getChild(String path)
Get a child |
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 |
long |
getLastModified()
When the file was last modified |
String |
getName()
Get the simple VF name (X.java) |
VirtualFile |
getParent()
Get the parent |
String |
getPathName()
Get the VFS relative path name (org/jboss/X.java) |
long |
getSize()
Get the size |
VFS |
getVFS()
Get the VFS instance for this virtual file |
boolean |
hasBeenModified()
Returns true if the file has been modified since this method was last called Last modified time is initialized at handler instantiation. |
int |
hashCode()
|
boolean |
isArchive()
Is the file archive. |
boolean |
isHidden()
Whether it is hidden |
boolean |
isLeaf()
Whether it is a simple leaf of the VFS, i.e. |
InputStream |
openStream()
Access the file contents. |
String |
toString()
|
URI |
toURI()
Get the VF URI (file://root/org/jboss/X.java) |
URL |
toURL()
Get the VF URL (file://root/org/jboss/X.java) |
void |
visit(VirtualFileVisitor visitor)
Visit the virtual file system |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VirtualFile(VirtualFileHandler handler)
handler
- the handler
IllegalArgumentException
- if the handler is nullMethod Detail |
---|
public String getName()
IllegalStateException
- if the file is closedpublic String getPathName()
IllegalStateException
- if the file is closedpublic URL toURL() throws MalformedURLException, URISyntaxException
MalformedURLException
- if a url cannot be parsed
URISyntaxException
- if a uri cannot be parsed
IllegalStateException
- if the file is closedpublic URI toURI() throws MalformedURLException, URISyntaxException
URISyntaxException
- if a uri cannot be parsed
IllegalStateException
- if the file is closed
MalformedURLException
- for a bad urlpublic long getLastModified() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic boolean hasBeenModified() throws IOException
IOException
- for any errorpublic long getSize() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic boolean exists() throws IOException
IOException
- - thrown on failure to detect existence.public boolean isLeaf() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic boolean isArchive() throws IOException
IOException
- for any errorpublic boolean isHidden() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic InputStream openStream() throws IOException
IOException
- for any error accessing the file system
IllegalStateException
- if the file is closedprotected void checkStreams()
public void closeStreams()
public void cleanup()
public void close()
public boolean delete() throws IOException
IOException
- if an error occurspublic boolean delete(int gracePeriod) throws IOException
gracePeriod
- max time to wait for any locks (in milliseconds)
IOException
- if an error occurspublic VFS getVFS()
IllegalStateException
- if the file is closedpublic VirtualFile getParent() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic List<VirtualFile> getChildren() throws IOException
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
filter
- to filter the children
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closed or it is a leaf nodepublic List<VirtualFile> getChildrenRecursively() throws IOException
This always uses VisitorAttributes.RECURSE
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closedpublic List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
This always uses VisitorAttributes.RECURSE
filter
- to filter the children
IOException
- for any problem accessing the virtual file system
IllegalStateException
- if the file is closed or it is a leaf nodepublic void visit(VirtualFileVisitor visitor) throws IOException
visitor
- the visitor
IOException
- for any problem accessing the virtual file system
IllegalArgumentException
- if the visitor is null
IllegalStateException
- if the file is closed@Deprecated public VirtualFile findChild(String path) throws IOException
path
- the path
IOException
- for any problem accessing the VFS (including the child does not exist)
IllegalArgumentException
- if the path is null
IllegalStateException
- if the file is closed or it is a leaf nodepublic VirtualFile getChild(String path) throws IOException
path
- the path
null
if not found
IOException
- for any problem accessing the VFS
IllegalArgumentException
- if the path is null
IllegalStateException
- if the file is closed or it is a leaf nodepublic String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |