public class Directory
extends java.lang.Object
Constructor and Description |
---|
Directory(java.io.File directory)
Constructor for a Directory.
|
Directory(java.io.File directory,
Directory parent)
Constructor for a Directory.
|
Modifier and Type | Method and Description |
---|---|
void |
addDirectory(Directory directory)
Add a directory to the child directories.
|
void |
addFile(java.io.File file)
Add a file to the list of files.
|
java.util.Iterator |
directoryIterator()
Get an iterator over the child Directories.
|
boolean |
equals(java.lang.Object obj)
The equality method.
|
java.util.Iterator |
filesIterator()
Get an iterator over the files.
|
int |
fileSize()
Get the number of files in the files attribute.
|
Directory |
getChild(java.io.File dir)
Get a child directory of this directory.
|
java.io.File |
getDirectory()
Get the directory file.
|
Directory |
getParent()
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.
|
int |
hashCode()
The hashcode method.
|
boolean |
isRoot()
Is this a root Directory?
|
public Directory(java.io.File directory)
directory
- a directory.public Directory(java.io.File directory, Directory parent)
directory
- a directoryparent
- a parent Directorypublic void addDirectory(Directory directory)
directory
- a Directorypublic void addFile(java.io.File file)
file
- a file to addpublic java.util.Iterator directoryIterator()
public java.util.Iterator filesIterator()
public Directory getParent()
public boolean isRoot()
public java.io.File getDirectory()
public Directory getChild(java.io.File dir)
dir
- the directory to look forpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare topublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String[] getPath()
public static java.lang.String[] getPath(java.lang.String thePath)
thePath
- the file path string to convertpublic int fileSize()