Package org.eclipse.sisu.space
Class FileEntryIterator
- java.lang.Object
-
- org.eclipse.sisu.space.FileEntryIterator
-
- All Implemented Interfaces:
java.util.Iterator<java.lang.String>
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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Deque<java.lang.String>
entryNames
private boolean
recurse
private java.lang.String
rootPath
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 aURL
into aFile
converting slashes and encoded characters where appropriate.
-
-
-
Constructor Detail
-
FileEntryIterator
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.- Parameters:
url
- The root file URLsubPath
- The path below the root URLrecurse
- Whentrue
include sub-directories; otherwise don't
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.String>
-
next
public java.lang.String next()
- Specified by:
next
in interfacejava.util.Iterator<java.lang.String>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<java.lang.String>
-
toFile
static java.io.File toFile(java.net.URL url)
Converts aURL
into aFile
converting slashes and encoded characters where appropriate.- Parameters:
url
- The file URL- Returns:
- File instance for the given URL
-
appendEntries
private void appendEntries(java.lang.String subPath)
Appends entries from the given sub-path to the cached list of named entries.- Parameters:
subPath
- The sub path
-
normalizePath
private static java.lang.String normalizePath(java.io.File file)
Returns the normalized URI path of the given file.- Parameters:
file
- The file to normalize- Returns:
- Normalized URI path
-
-