|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.io.vfs.AbstractVfsDirectory
public abstract class AbstractVfsDirectory
A standard abstract implementation of com.partnersoft.io.VfsDirectory. Includes implementations of the various convenience methods derived from the essential methods, and provides the vfs and path properties.
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 Summary | |
|---|---|
AbstractVfsDirectory(Vfs vfs,
Path path)
Create a new AbstractVfsDirectory with the given vfs and path. |
|
| Method Summary | |
|---|---|
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> |
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> |
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 '.'). |
java.lang.String |
getName()
Bare name of node. |
Path |
getPath()
The path to the Vfs node. |
Vfs |
getVfs()
The Vfs this node is in. |
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> |
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> |
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 file to the new path on the same Vfs. |
VfsDirectory |
moveTo(VfsDirectory destination)
Moves the file to the destination given. |
VfsDirectory |
renameTo(java.lang.String name)
Renames the directory. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.partnersoft.io.vfs.VfsDirectory |
|---|
remove |
| Methods inherited from interface com.partnersoft.io.vfs.VfsNode |
|---|
getUri, getUrl, toFile |
| Constructor Detail |
|---|
public AbstractVfsDirectory(Vfs vfs,
Path path)
vfs - Vfs that the directory is in.path - path to directory in the Vfs.| Method Detail |
|---|
public 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
VfsNode
make 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 subdirectory
public 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 file
public 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 subdirectory
public 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 file
public VfsDirectory directoryFor(java.lang.String subPathString)
VfsDirectory
directoryFor in interface VfsDirectorypublic VfsFile fileFor(java.lang.String subPathString)
VfsDirectory
fileFor in interface VfsDirectory
public abstract java.util.List<VfsNode> listNodes()
throws java.io.IOException
VfsDirectory
listNodes in interface VfsDirectoryjava.io.IOException - if listing fails
public abstract java.util.List<VfsFile> listFiles()
throws java.io.IOException
VfsDirectory
listFiles in interface VfsDirectoryjava.io.IOException
public abstract java.util.List<VfsDirectory> listDirectories()
throws java.io.IOException
VfsDirectory
listDirectories in interface VfsDirectoryjava.io.IOException
public java.util.List<VfsNode> listNodesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
listNodesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOExceptionPattern
public java.util.List<VfsFile> listFilesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
listFilesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOExceptionPattern
public java.util.List<VfsFile> listFilesWithExtension(java.lang.String extension)
throws java.io.IOException
VfsDirectory
listFilesWithExtension in interface VfsDirectoryextension - file extension
java.io.IOException
public java.util.List<VfsFile> listFilesWithBaseName(java.lang.String baseName)
throws java.io.IOException
VfsDirectory
listFilesWithBaseName in interface VfsDirectorybaseName - base name to look for
java.io.IOException
public java.util.List<VfsDirectory> listDirectoriesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
listDirectoriesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOExceptionPattern
public java.util.List<VfsNode> findNodes()
throws java.io.IOException
VfsDirectory
findNodes in interface VfsDirectoryjava.io.IOException - if something bad happens
public java.util.List<VfsFile> findFiles()
throws java.io.IOException
VfsDirectory
findFiles in interface VfsDirectoryjava.io.IOException - if something bad happens
public java.util.List<VfsDirectory> findDirectories()
throws java.io.IOException
VfsDirectory
findDirectories in interface VfsDirectoryjava.io.IOException - if something bad happens
public java.util.List<VfsFile> findFilesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
findFilesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOException - if something bad happensPattern
public java.util.List<VfsFile> findFilesWithExtension(java.lang.String extension)
throws java.io.IOException
VfsDirectory
findFilesWithExtension in interface VfsDirectoryextension - file extension
java.io.IOException - if something bad happensPattern
public java.util.List<VfsDirectory> findDirectoriesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
findDirectoriesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOException - if something bad happensPattern
public java.util.List<VfsNode> findNodesLike(java.lang.String pattern)
throws java.io.IOException
VfsDirectory
findNodesLike in interface VfsDirectorypattern - regular expression pattern
java.io.IOException - if something bad happensPattern
public VfsDirectory copyTo(VfsDirectory destination)
throws java.io.IOException
VfsDirectory
copyTo in interface VfsDirectoryjava.io.IOException
public VfsDirectory copyTo(Path path)
throws java.io.IOException
VfsDirectory
copyTo in interface VfsDirectoryjava.io.IOException
public VfsDirectory renameTo(java.lang.String name)
throws java.io.IOException
VfsDirectory
renameTo in interface VfsDirectoryjava.io.IOException
public VfsDirectory moveTo(Path newPath)
throws java.io.IOException
VfsDirectory
moveTo in interface VfsDirectoryjava.io.IOException
public VfsDirectory moveTo(VfsDirectory destination)
throws java.io.IOException
VfsDirectory
moveTo in interface VfsDirectoryjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic Path getPath()
VfsNode
getPath in interface VfsNodepublic Path getAbsolutePath()
VfsNode
getAbsolutePath in interface VfsNodepublic Vfs getVfs()
VfsNode
getVfs in interface VfsNodepublic java.lang.String getName()
VfsNode
getName in interface VfsNodepublic java.lang.String getBaseName()
VfsNode
getBaseName in interface VfsNodepublic java.lang.String getExtension()
VfsNode
getExtension in interface VfsNodepublic VfsDirectory getDirectory()
VfsNode
getDirectory in interface VfsNodepublic boolean isBackup()
VfsNode
isBackup in interface VfsNodepublic boolean isHidden()
VfsNode
isHidden in interface VfsNodepublic boolean equals(java.lang.Object nother)
equals in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||