public interface VfsDirectory extends VfsNode
VFSDirectories act just like directories in a typical filesystem. They can contain other files or subdirectories. From a behavioral perspective, VFSDirectories serve as the focus of listing and finding activities in a Vfs.
Methods starting with "list" list the directory's direct children only (not nodes beneath subdirectories). These methods are analogous to the Unix "ls" command.
Methods starting with "find" list the directory's direct children and also descendents in subdirectories (and subdirectories of the subdirectories, and so forth). These methods are analogous to the Unix "find" command.
"List" and "find" methods with no arguments return all items of the specified type. Those that end with "Like" and take a regular-expression argument allow you to filter the results, e.g.
results = vfsdir.listFilesLike("*.txt");
Methods starting with "create" create a VfsDirectory or VfsFile with the given name or path. This directory or file does not have to exist.
Concrete implementations of VfsDirectory are provided by a VFSModule.
Copyright 2006 Partner Software, Inc.
| 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 path)
Creates a new subdirectory address object, placed relative to this
directory according to the given path.
|
VfsDirectory |
directoryFor(java.lang.String pathString)
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 |
exists()
Whether the Vfs node exists.
|
VfsFile |
fileFor(Path path)
Creates a new file address object, placed within relative to this
directory according to the given path.
|
VfsFile |
fileFor(java.lang.String pathString)
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.
|
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.
|
java.util.List<VfsFile> |
listFiles()
Lists all files (not directories) in this directory.
|
java.util.List<VfsFile> |
listFilesExcluding(java.lang.String extension)
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.
|
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.
|
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.
|
void |
remove()
Removes the directory AND ALL ITS CONTENTS.
|
VfsDirectory |
renameTo(java.lang.String name)
Renames the directory.
|
getAbsolutePath, getBaseName, getDirectory, getExtension, getLastModified, getLastModifiedMillis, getName, getPath, getUri, getUrl, getVfs, isBackup, isHidden, setLastModified, setLastModifiedMillis, toFileboolean exists()
throws java.io.IOException
VfsNodeVfsNode.make() to create the node if it does not exist.void make()
throws java.io.IOException
VfsNodeVfsDirectory directoryNamed(java.lang.String name)
Path 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
make() method for that.
name - name of subdirectoryVfsFile fileNamed(java.lang.String name)
Path 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 make()
method for that.
name - name of fileVfsDirectory directoryFor(Path path)
Note that this creates a new VfsDirectory address object, but does NOT
make the actual filesystem directory if it does not exist. Use the
make() method for that.
path - to subdirectoryVfsDirectory directoryFor(java.lang.String pathString)
VfsFile fileFor(Path path)
Note that this creates a new VfsFile address object, but does NOT make
the actual file object if it does not exist. Use the make()
method for that.
path - path to fileVfsFile fileFor(java.lang.String pathString)
java.util.List<VfsNode> listNodes() throws java.io.IOException
java.io.IOException - if listing failsjava.util.List<VfsFile> listFiles() throws java.io.IOException
java.io.IOExceptionjava.util.List<VfsDirectory> listDirectories() throws java.io.IOException
java.io.IOExceptionjava.util.List<VfsNode> listNodesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOExceptionPatternjava.util.List<VfsFile> listFilesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOExceptionPatternjava.util.List<VfsFile> listFilesWithExtension(java.lang.String extension) throws java.io.IOException
extension - file extensionjava.io.IOExceptionjava.util.List<VfsFile> listFilesExcluding(java.lang.String extension) throws java.io.IOException
extension - file extensionjava.io.IOExceptionjava.util.List<VfsFile> listFilesWithBaseName(java.lang.String baseName) throws java.io.IOException
baseName - base name to look forjava.io.IOExceptionjava.util.List<VfsDirectory> listDirectoriesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOExceptionPatternjava.util.List<VfsDirectory> listDirectoriesExcluding(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOExceptionPatternjava.util.List<VfsNode> findNodes() throws java.io.IOException
java.io.IOException - if something bad happensjava.util.List<VfsFile> findFiles() throws java.io.IOException
java.io.IOException - if something bad happensjava.util.List<VfsDirectory> findDirectories() throws java.io.IOException
java.io.IOException - if something bad happensjava.util.List<VfsNode> findNodesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOException - if something bad happensPatternjava.util.List<VfsDirectory> findDirectoriesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOException - if something bad happensPatternjava.util.List<VfsDirectory> findDirectoriesExcluding(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOException - if something bad happensPatternjava.util.List<VfsFile> findFilesLike(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOException - if something bad happensPatternjava.util.List<VfsFile> findFilesExcluding(java.lang.String pattern) throws java.io.IOException
pattern - regular expression patternjava.io.IOException - if something bad happensPatternjava.util.List<VfsFile> findFilesWithExtension(java.lang.String extension) throws java.io.IOException
extension - file extensionjava.io.IOException - if something bad happensPatternVfsDirectory copyTo(VfsDirectory destination) throws java.io.IOException
java.io.IOExceptionVfsDirectory copyTo(Path path) throws java.io.IOException
java.io.IOExceptionvoid remove()
throws java.io.IOException
java.io.IOExceptionVfsDirectory renameTo(java.lang.String name) throws java.io.IOException
java.io.IOExceptionVfsDirectory moveTo(Path newPath) throws java.io.IOException
java.io.IOExceptionVfsDirectory moveTo(VfsDirectory destination) throws java.io.IOException
java.io.IOException