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>Iteratorthat iterates over named entries beneath a file-system directory.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Deque<java.lang.String>entryNamesprivate booleanrecurseprivate java.lang.StringrootPath
-
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 voidappendEntries(java.lang.String subPath)Appends entries from the given sub-path to the cached list of named entries.booleanhasNext()java.lang.Stringnext()private static java.lang.StringnormalizePath(java.io.File file)Returns the normalized URI path of the given file.voidremove()(package private) static java.io.FiletoFile(java.net.URL url)Converts aURLinto aFileconverting 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- Whentrueinclude sub-directories; otherwise don't
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<java.lang.String>
-
next
public java.lang.String next()
- Specified by:
nextin interfacejava.util.Iterator<java.lang.String>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<java.lang.String>
-
toFile
static java.io.File toFile(java.net.URL url)
Converts aURLinto aFileconverting 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
-
-