final class FileEntryIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.String>
Iterator
that iterates over named entries beneath a file-system directory.Modifier and Type | Field and Description |
---|---|
private java.util.Deque<java.lang.String> |
entryNames |
private boolean |
recurse |
private java.lang.String |
rootPath |
Constructor and Description |
---|
FileEntryIterator(java.net.URL url,
java.lang.String subPath,
boolean recurse)
Creates an iterator that iterates over entries beneath the given file URL and sub-path.
|
Modifier and Type | Method and Description |
---|---|
private void |
appendEntries(java.lang.String subPath)
Appends entries from the given sub-path to the cached list of named entries.
|
boolean |
hasNext() |
java.lang.String |
next() |
private static java.lang.String |
normalizePath(java.io.File file)
Returns the normalized URI path of the given file.
|
void |
remove() |
(package private) static java.io.File |
toFile(java.net.URL url)
Converts a
URL into a File converting slashes and encoded characters where appropriate. |
private final java.lang.String rootPath
private final java.util.Deque<java.lang.String> entryNames
private final boolean recurse
FileEntryIterator(java.net.URL url, java.lang.String subPath, boolean recurse)
url
- The root file URLsubPath
- The path below the root URLrecurse
- When true
include sub-directories; otherwise don'tpublic boolean hasNext()
hasNext
in interface java.util.Iterator<java.lang.String>
public java.lang.String next()
next
in interface java.util.Iterator<java.lang.String>
public void remove()
remove
in interface java.util.Iterator<java.lang.String>
static java.io.File toFile(java.net.URL url)
URL
into a File
converting slashes and encoded characters where appropriate.url
- The file URLprivate void appendEntries(java.lang.String subPath)
subPath
- The sub pathprivate static java.lang.String normalizePath(java.io.File file)
file
- The file to normalize