|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.io.PathSet
Unique file list manager.
Details: PathSet is an ordered file set manager designed to help you generate a file list from user-supplied arguments. It allows you to add and subtract sets of files either by naming the individual files or by naming directories that can be searched recursively.
PathSet
detects duplicate entries and automatically keeps them out of the set. PathSet
even detects when two apparently different paths represent the same path due to "symlink magic." PathSet
also preserves the order in which the files were added. When two equivalent paths are added, the first path added gets priority, unless the first is removed before the second is added.
After a set is formed, iterator methods can be used to walk through the ordered list of files.
Constructor Summary | |
PathSet(boolean dirs_allowed)
Initializes empty set. |
Method Summary | |
void |
add(java.io.File file)
Convenience method. |
void |
add(Path path)
Appends path to set. |
void |
addRecursively(java.io.File file)
Convenience method. |
void |
addRecursively(Path path)
Appends directory to set. |
java.util.Enumeration |
enumerate()
Enumerates set. |
void |
remove(java.io.File file)
Convenience method. |
void |
remove(Path path)
Removes path from set. |
void |
removeRecursively(java.io.File file)
Convenience method. |
void |
removeRecursively(Path path)
Removes directory from set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PathSet(boolean dirs_allowed)
Details: This constructor initializes an empty set and determines whether directory paths (as opposed to actual files) can be added to the set. If dirs_allowed
is true, the set will accept directory paths. Otherwise, directory paths will be automatically discarded when added.
dirs_allowed
- Method Detail |
public void add(Path path) throws java.io.IOException
Details: add
appends the given path (path) to the end of the set if the path is not already a member of the set. path will not be retained in the set if it is a directory and dirs_allowed is false
.
Polymorphism warning: This method is called by add(String)
and addRecursively(Path)
.
path
- the path to addjava.io.IOException
- if file examination failspublic final void add(java.io.File file) throws java.io.IOException
Details: This convenience method converts the given File
to a Path
and calls add(Path)
.
public void addRecursively(Path path) throws java.io.IOException
Details: addRecursively
appends the given Path
and, if it is a directory, all of the Path
s underneath it, recursively, to the set. Some paths may not be added if they represent directories and allow_dirs is false.
Polymorphism warnings: This method calls add(Path) for each individual path added to the set. This method is called by addRecursively(String)
.
path
- the path to addjava.io.IOException
- if file examination failspublic final void addRecursively(java.io.File file) throws java.io.IOException
Details: This convenience method converts the given File
to a Path
and calls addRecursively(Path)
.
public void remove(Path path) throws java.io.IOException
Details: remove
removes the given Path (path) from this set if it is currently in the set. If path is not in the set, this method has no effect.
Polymorphism warning: This method is called by remove(String)
and removeRecursively(Path)
path
- the path to removepublic void remove(java.io.File file) throws java.io.IOException
Details: This convenience method converts the given File
to a Path
and calls remove(Path)
.
public void removeRecursively(Path path) throws java.io.IOException
Details: remove
removes the given Path
(path) and, if it is a directory, all of the Path
s underneath it, recursively, from this set.
Polymorphism warnings: This method calls remove(Path)
for each individual Path
to be removed from the set. This method is called by removeRecursively(String)
.
path
- the path to removepublic void removeRecursively(java.io.File file) throws java.io.IOException
Details: This convenience method converts the given File
to a Path
and calls removeRecursively(Path)
.
public java.util.Enumeration enumerate()
Details: enumerate returns and Enumeration that lists every Path currently in this set.
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |