public abstract class AbstractVfsDirectory extends java.lang.Object implements VfsDirectory
Most implementations of VfsDirectory should extend this class.
A minimal set of methods has been declared abstract. All other methods are derived from these with default implementations. For example, the various regex-patterned forms of the list and find methods simply call the unpatterned methods and then filter them by checking them against the pattern, returning the result.
Feel free to override these with more efficient implementations if you have such available.
Copyright 2006 Partner Software, Inc.
| Constructor and Description |
|---|
AbstractVfsDirectory(Vfs vfs,
Path path)
Create a new AbstractVfsDirectory with the given vfs and path.
|
| Modifier and Type | Method and Description |
|---|---|
VfsDirectory |
copyTo(Path path)
Does a recursive copy of this directory's contents to the path provided
in the same Vfs.
|
VfsDirectory |
copyTo(VfsDirectory destination)
Does a recursive copy of this directory's contents to the directory
provided.
|
VfsDirectory |
directoryFor(Path subPath)
Creates a new subdirectory address object, placed relative to this
directory according to the given path.
|
VfsDirectory |
directoryFor(java.lang.String subPathString)
Same as directoryFor(new Path(pathString)).
|
VfsDirectory |
directoryNamed(java.lang.String name)
Creates a new subdirectory address object, placed within this directory,
with the given name.
|
boolean |
equals(java.lang.Object nother) |
abstract boolean |
exists()
Whether the Vfs node exists.
|
VfsFile |
fileFor(Path subPath)
Creates a new file address object, placed within relative to this
directory according to the given path.
|
VfsFile |
fileFor(java.lang.String subPathString)
Same as fileFor(new Path(pathString)).
|
VfsFile |
fileNamed(java.lang.String name)
Creates a new file address object, placed within this directory, with the
given name.
|
java.util.List<VfsDirectory> |
findDirectories()
Does a recursive, downward search through the descendents of this
directory, returning all directories (not files) found.
|
java.util.List<VfsDirectory> |
findDirectoriesExcluding(java.lang.String pattern)
Does a recursive, downward search through the descendents of this
directory, returning all directories (not files) found that DO NOT match the
given pattern.
|
java.util.List<VfsDirectory> |
findDirectoriesLike(java.lang.String pattern)
Does a recursive, downward search through the descendents of this
directory, returning all directories (not files) found that match the
given pattern.
|
java.util.List<VfsFile> |
findFiles()
Does a recursive, downward search through the descendents of this
directory, returning the files (not directories) found.
|
java.util.List<VfsFile> |
findFilesExcluding(java.lang.String pattern)
Does a recursive, downward search through the descendents of this
directory, returning all files (not directories) found that DO NOT match the
given pattern.
|
java.util.List<VfsFile> |
findFilesLike(java.lang.String pattern)
Does a recursive, downward search through the descendents of this
directory, returning all files (not directories) found that match the
given pattern.
|
java.util.List<VfsFile> |
findFilesWithExtension(java.lang.String extension)
Does a recursive, downward search through the descendents of this
directory, returning all files (not directories) found that have the given extension.
|
java.util.List<VfsNode> |
findNodes()
Does a recursive, downward search through the descendents of this
directory, returning all nodes (files and directories) found.
|
java.util.List<VfsNode> |
findNodesLike(java.lang.String pattern)
Does a recursive, downward search through the descendents of this
directory, returning all nodes (files and directories) found that match
the given pattern.
|
Path |
getAbsolutePath()
The absolute path to the Vfs node.
|
java.lang.String |
getBaseName()
Base name of node; this is the part before the '.' if there's a file
extension.
|
VfsDirectory |
getDirectory()
The VfsDirectory this node is in, or null if it is the root directory.
|
java.lang.String |
getExtension()
File extension (the part after the '.' in most file names; includes the
'.').
|
DateAndTime |
getLastModified()
Returns the date and time the node was last modified.
|
long |
getLastModifiedMillis()
Returns the timestamp in milliseconds that the node was last modified.
|
java.lang.String |
getName()
Bare name of node.
|
Path |
getPath()
The path to the Vfs node.
|
Vfs |
getVfs()
The Vfs this node is in.
|
int |
hashCode() |
boolean |
isBackup()
True if the file is a backup file - commonly this is based on file name patterns like *~ or *.bak.
|
boolean |
isHidden()
True if the file is a hidden file - commonly this is based on the file name starting with a ".".
|
abstract java.util.List<VfsDirectory> |
listDirectories()
Lists all directories (not files) in this directory.
|
java.util.List<VfsDirectory> |
listDirectoriesExcluding(java.lang.String pattern)
Lists all directories (not files) in this directory excluding the given
regular expression pattern.
|
java.util.List<VfsDirectory> |
listDirectoriesLike(java.lang.String pattern)
Lists all directories (not files) in this directory with the given
regular expression pattern.
|
abstract java.util.List<VfsFile> |
listFiles()
Lists all files (not directories) in this directory.
|
java.util.List<VfsFile> |
listFilesExcluding(java.lang.String pattern)
Lists all files (not directories) in this directory excluding
the given regular expression pattern.
|
java.util.List<VfsFile> |
listFilesLike(java.lang.String pattern)
Lists all files (not directories) in this directory with the given
regular expression pattern.
|
java.util.List<VfsFile> |
listFilesWithBaseName(java.lang.String baseName)
Lists all files (not directories) in this directory with the basename (name without extension)
You should not include the period (.)
|
java.util.List<VfsFile> |
listFilesWithExtension(java.lang.String extension)
Lists all files (not directories) in this directory with the given
extension.
|
abstract java.util.List<VfsNode> |
listNodes()
Lists all nodes (both directories and files) in this directory.
|
java.util.List<VfsNode> |
listNodesLike(java.lang.String pattern)
Lists all nodes (both directories and files) in this directory with the
given regular expression pattern.
|
abstract void |
make()
Creates the node and any ancestor directories needed to contain it.
|
VfsDirectory |
moveTo(Path newPath)
Moves the directory to the new path on the same Vfs.
|
VfsDirectory |
moveTo(VfsDirectory destination)
Moves the directory to the destination given.
|
VfsDirectory |
renameTo(java.lang.String name)
Renames the directory.
|
void |
setLastModified(DateAndTime newLast)
If possible, sets the date and time the node was last modified.
|
void |
setLastModifiedMillis(long millis)
If possible, sets the date and time the node was last modified in
milliseconds.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitremovepublic abstract boolean exists()
throws java.io.IOException
VfsNodeVfsNode.make() to create the node if it does not exist.exists in interface VfsDirectoryexists in interface VfsNodejava.io.IOException - if it can't tell for some reason.public abstract void make()
throws java.io.IOException
VfsNodemake in interface VfsDirectorymake in interface VfsNodejava.io.IOException - if it can't.public VfsDirectory directoryNamed(java.lang.String name)
VfsDirectoryPath object and use the pathwise version for
that.
Note that this creates a new VfsDirectory address object, but does NOT
make the actual filesystem directory if it does not exist. Use the
VfsDirectory.make() method for that.
directoryNamed in interface VfsDirectoryname - name of subdirectorypublic VfsFile fileNamed(java.lang.String name)
VfsDirectoryPath object and use the pathwise version for
that.
Note that this creates a new VfsFile address object, but does NOT make
the actual file object if it does not exist. Use the VfsDirectory.make()
method for that.
fileNamed in interface VfsDirectoryname - name of filepublic VfsDirectory directoryFor(Path subPath)
VfsDirectory
Note that this creates a new VfsDirectory address object, but does NOT
make the actual filesystem directory if it does not exist. Use the
VfsDirectory.make() method for that.
directoryFor in interface VfsDirectorysubPath - to subdirectorypublic VfsFile fileFor(Path subPath)
VfsDirectory
Note that this creates a new VfsFile address object, but does NOT make
the actual file object if it does not exist. Use the VfsDirectory.make()
method for that.
fileFor in interface VfsDirectorysubPath - path to filepublic VfsDirectory directoryFor(java.lang.String subPathString)
VfsDirectorydirectoryFor in interface VfsDirectorypublic VfsFile fileFor(java.lang.String subPathString)
VfsDirectoryfileFor in interface VfsDirectorypublic abstract java.util.List<VfsNode> listNodes() throws java.io.IOException
VfsDirectorylistNodes in interface VfsDirectoryjava.io.IOException - if listing failspublic abstract java.util.List<VfsFile> listFiles() throws java.io.IOException
VfsDirectorylistFiles in interface VfsDirectoryjava.io.IOExceptionpublic abstract java.util.List<VfsDirectory> listDirectories() throws java.io.IOException
VfsDirectorylistDirectories in interface VfsDirectoryjava.io.IOExceptionpublic java.util.List<VfsNode> listNodesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectorylistNodesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOExceptionPatternpublic java.util.List<VfsFile> listFilesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectorylistFilesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOExceptionPatternpublic java.util.List<VfsFile> listFilesWithExtension(java.lang.String extension) throws java.io.IOException
VfsDirectorylistFilesWithExtension in interface VfsDirectoryextension - file extensionjava.io.IOExceptionpublic java.util.List<VfsFile> listFilesWithBaseName(java.lang.String baseName) throws java.io.IOException
VfsDirectorylistFilesWithBaseName in interface VfsDirectorybaseName - base name to look forjava.io.IOExceptionpublic java.util.List<VfsFile> listFilesExcluding(java.lang.String pattern) throws java.io.IOException
VfsDirectorylistFilesExcluding in interface VfsDirectorypattern - file extensionjava.io.IOExceptionpublic java.util.List<VfsDirectory> listDirectoriesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectorylistDirectoriesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOExceptionPatternpublic java.util.List<VfsDirectory> listDirectoriesExcluding(java.lang.String pattern) throws java.io.IOException
VfsDirectorylistDirectoriesExcluding in interface VfsDirectorypattern - regular expression patternjava.io.IOExceptionPatternpublic java.util.List<VfsNode> findNodes() throws java.io.IOException
VfsDirectoryfindNodes in interface VfsDirectoryjava.io.IOException - if something bad happenspublic java.util.List<VfsFile> findFiles() throws java.io.IOException
VfsDirectoryfindFiles in interface VfsDirectoryjava.io.IOException - if something bad happenspublic java.util.List<VfsDirectory> findDirectories() throws java.io.IOException
VfsDirectoryfindDirectories in interface VfsDirectoryjava.io.IOException - if something bad happenspublic java.util.List<VfsFile> findFilesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectoryfindFilesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOException - if something bad happensPatternpublic java.util.List<VfsFile> findFilesExcluding(java.lang.String pattern) throws java.io.IOException
VfsDirectoryfindFilesExcluding in interface VfsDirectorypattern - regular expression patternjava.io.IOException - if something bad happensPatternpublic java.util.List<VfsFile> findFilesWithExtension(java.lang.String extension) throws java.io.IOException
VfsDirectoryfindFilesWithExtension in interface VfsDirectoryextension - file extensionjava.io.IOException - if something bad happensPatternpublic java.util.List<VfsDirectory> findDirectoriesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectoryfindDirectoriesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOException - if something bad happensPatternpublic java.util.List<VfsDirectory> findDirectoriesExcluding(java.lang.String pattern) throws java.io.IOException
VfsDirectoryfindDirectoriesExcluding in interface VfsDirectorypattern - regular expression patternjava.io.IOException - if something bad happensPatternpublic java.util.List<VfsNode> findNodesLike(java.lang.String pattern) throws java.io.IOException
VfsDirectoryfindNodesLike in interface VfsDirectorypattern - regular expression patternjava.io.IOException - if something bad happensPatternpublic VfsDirectory copyTo(VfsDirectory destination) throws java.io.IOException
VfsDirectorycopyTo in interface VfsDirectoryjava.io.IOExceptionpublic VfsDirectory copyTo(Path path) throws java.io.IOException
VfsDirectorycopyTo in interface VfsDirectoryjava.io.IOExceptionpublic VfsDirectory renameTo(java.lang.String name) throws java.io.IOException
VfsDirectoryrenameTo in interface VfsDirectoryjava.io.IOExceptionpublic VfsDirectory moveTo(Path newPath) throws java.io.IOException
VfsDirectorymoveTo in interface VfsDirectoryjava.io.IOExceptionpublic VfsDirectory moveTo(VfsDirectory destination) throws java.io.IOException
VfsDirectorymoveTo in interface VfsDirectoryjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic Path getAbsolutePath()
VfsNodegetAbsolutePath in interface VfsNodepublic java.lang.String getName()
VfsNodepublic java.lang.String getBaseName()
VfsNodegetBaseName in interface VfsNodepublic java.lang.String getExtension()
VfsNodegetExtension in interface VfsNodepublic VfsDirectory getDirectory()
VfsNodegetDirectory in interface VfsNodepublic boolean isBackup()
VfsNodepublic boolean isHidden()
VfsNodepublic boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic DateAndTime getLastModified() throws java.io.IOException
VfsNodenew DateAndTime(getLastModifiedMillis()).getLastModified in interface VfsNodejava.io.IOExceptionpublic void setLastModified(DateAndTime newLast) throws java.io.IOException
VfsNodesetLastModifiedMillis(newLast.getMillis()).setLastModified in interface VfsNodejava.io.IOExceptionpublic long getLastModifiedMillis()
throws java.io.IOException
VfsNodegetLastModified().getMillis().
If this capability is unsupported by the VFS implementation, returns 0.
getLastModifiedMillis in interface VfsNodejava.io.IOExceptionpublic void setLastModifiedMillis(long millis)
throws java.io.IOException
VfsNodesetLastModified(new DateAndTime(millis)).
If this capability is unsupported by the VFS implementation, does nothing.
setLastModifiedMillis in interface VfsNodejava.io.IOException