Class Directory
- java.lang.Object
- 
- org.apache.tools.ant.taskdefs.optional.ssh.Directory
 
- 
 public class Directory extends java.lang.ObjectA helper object for Scp representing a directory in a file system.
- 
- 
Method SummaryModifier and Type Method Description voidaddDirectory(Directory directory)Add a directory to the child directories.voidaddFile(java.io.File file)Add a file to the list of files.java.util.Iterator<Directory>directoryIterator()Get an iterator over the child Directories.booleanequals(java.lang.Object obj)The equality method.java.util.Iterator<java.io.File>filesIterator()Get an iterator over the files.intfileSize()Get the number of files in the files attribute.DirectorygetChild(java.io.File dir)Get a child directory of this directory.java.io.FilegetDirectory()Get the directory file.DirectorygetParent()Get the parent Directory.java.lang.String[]getPath()Get the path components of this directory.static java.lang.String[]getPath(java.lang.String thePath)Convert a file path to an array of path components.inthashCode()The hashcode method.booleanisRoot()Is this a root Directory?
 
- 
- 
- 
Constructor Detail- 
Directorypublic Directory(java.io.File directory) Constructor for a Directory.- Parameters:
- directory- a directory.
 
 - 
Directorypublic Directory(java.io.File directory, Directory parent)Constructor for a Directory.- Parameters:
- directory- a directory
- parent- a parent Directory
 
 
- 
 - 
Method Detail- 
addDirectorypublic void addDirectory(Directory directory) Add a directory to the child directories.- Parameters:
- directory- a Directory
 
 - 
addFilepublic void addFile(java.io.File file) Add a file to the list of files.- Parameters:
- file- a file to add
 
 - 
directoryIteratorpublic java.util.Iterator<Directory> directoryIterator() Get an iterator over the child Directories.- Returns:
- an iterator
 
 - 
filesIteratorpublic java.util.Iterator<java.io.File> filesIterator() Get an iterator over the files.- Returns:
- an iterator
 
 - 
getParentpublic Directory getParent() Get the parent Directory.- Returns:
- the parent Directory.
 
 - 
isRootpublic boolean isRoot() Is this a root Directory?- Returns:
- true if there is no parent Directory
 
 - 
getDirectorypublic java.io.File getDirectory() Get the directory file.- Returns:
- the directory file
 
 - 
getChildpublic Directory getChild(java.io.File dir) Get a child directory of this directory.- Parameters:
- dir- the directory to look for
- Returns:
- the child directory, or null if not found
 
 - 
equalspublic boolean equals(java.lang.Object obj) The equality method. This checks if the directory field is the same.- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- obj- the object to compare to
- Returns:
- true if this object has an equal directory field as the other object
 
 - 
hashCodepublic int hashCode() The hashcode method.- Overrides:
- hashCodein class- java.lang.Object
- Returns:
- the hash code of the directory field
 
 - 
getPathpublic java.lang.String[] getPath() Get the path components of this directory.- Returns:
- the path components as an array of strings.
 
 - 
getPathpublic static java.lang.String[] getPath(java.lang.String thePath) Convert a file path to an array of path components. This uses File.separator to split the file path string.- Parameters:
- thePath- the file path string to convert
- Returns:
- an array of path components
 
 - 
fileSizepublic int fileSize() Get the number of files in the files attribute.- Returns:
- the number of files
 
 
- 
 
-