org.apache.tools.ant.taskdefs.optional.ssh
Class Directory
java.lang.Object
org.apache.tools.ant.taskdefs.optional.ssh.Directory
public class Directory
extends java.lang.Object
A helper object for Scp representing a directory in a file system.
void | addDirectory(Directory directory) - Add a directory to the child directories.
|
void | addFile(File file) - Add a file to the list of files.
|
Iterator | directoryIterator() - Get an iterator over the child Directories.
|
boolean | equals(Object obj) - The equality method.
|
int | fileSize() - Get the number of files in the files attribute.
|
Iterator | filesIterator() - Get an iterator over the files.
|
Directory | getChild(File dir) - Get a child directory of this directory.
|
File | getDirectory() - Get the directory file.
|
Directory | getParent() - Get the parent Directory.
|
String[] | getPath() - Get the path components of this directory.
|
static String[] | getPath(String thePath) - Convert a file path to an array of path components.
|
int | hashCode() - The hashcode method.
|
boolean | isRoot() - Is this a root Directory?
|
Directory
public Directory(File directory)
Constructor for a Directory.
Directory
public Directory(File directory,
Directory parent)
Constructor for a Directory.
directory
- a directoryparent
- a parent Directory
addDirectory
public void addDirectory(Directory directory)
Add a directory to the child directories.
addFile
public void addFile(File file)
Add a file to the list of files.
directoryIterator
public Iterator directoryIterator()
Get an iterator over the child Directories.
equals
public boolean equals(Object obj)
The equality method.
This checks if the directory field is the same.
obj
- the object to compare to
- true if this object has an equal directory field as the other object
fileSize
public int fileSize()
Get the number of files in the files attribute.
filesIterator
public Iterator filesIterator()
Get an iterator over the files.
getChild
public Directory getChild(File dir)
Get a child directory of this directory.
dir
- the directory to look for
- the child directory, or null if not found
getDirectory
public File getDirectory()
Get the directory file.
getParent
public Directory getParent()
Get the parent Directory.
getPath
public String[] getPath()
Get the path components of this directory.
- the path components as an array of strings.
getPath
public static String[] getPath(String thePath)
Convert a file path to an array of path components.
This uses File.sepatator to split the file path string.
thePath
- the file path string to convert
- an array of path components
hashCode
public int hashCode()
The hashcode method.
- the hash code of the directory field
isRoot
public boolean isRoot()
Is this a root Directory?
- true if there is no parent Directory