Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class FilesystemIterator extends Object implements Comparable<FilesystemIterator>
| Constructor and Description |
|---|
FilesystemIterator(Map<String,FilesystemIteratorRule> rules,
Map<String,FilesystemIteratorRule> prefixRules)
Constructs an iterator without any filename conversions and starting at all roots.
|
FilesystemIterator(Map<String,FilesystemIteratorRule> rules,
Map<String,FilesystemIteratorRule> prefixRules,
boolean isPreorder,
boolean isSorted)
Constructs an iterator without any filename conversions and starting at all roots.
|
FilesystemIterator(Map<String,FilesystemIteratorRule> rules,
Map<String,FilesystemIteratorRule> prefixRules,
String startPath)
Constructs a file system iterator with the provided rules and conversion.
|
FilesystemIterator(Map<String,FilesystemIteratorRule> rules,
Map<String,FilesystemIteratorRule> prefixRules,
String startPath,
boolean isPreorder,
boolean isSorted)
Constructs a file system iterator with the provided rules and conversion.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(FilesystemIterator other) |
Iterator<String> |
getFilenameIterator()
Gets an iterator of filenames.
|
protected String[] |
getFilesystemRoots()
Gets the file system roots.
|
File |
getNextFile()
Gets the next file from the iterator or
null if the iterator has completed the iteration of the file system. |
int |
getNextFiles(File[] files,
int batchSize)
Gets the next files, up to batchSize.
|
String |
getStartPath()
Gets the start path for this iterator.
|
protected boolean |
isFilesystemRoot(String filename)
Determines if a path is a possible file system root
|
boolean |
isPreorder()
Gets the preorder flag for this iterator.
|
boolean |
isSorted()
Gets the sort flag for this iterator.
|
public FilesystemIterator(Map<String,FilesystemIteratorRule> rules, Map<String,FilesystemIteratorRule> prefixRules)
public FilesystemIterator(Map<String,FilesystemIteratorRule> rules, Map<String,FilesystemIteratorRule> prefixRules, boolean isPreorder, boolean isSorted)
public FilesystemIterator(Map<String,FilesystemIteratorRule> rules, Map<String,FilesystemIteratorRule> prefixRules, String startPath)
public FilesystemIterator(Map<String,FilesystemIteratorRule> rules, Map<String,FilesystemIteratorRule> prefixRules, String startPath, boolean isPreorder, boolean isSorted)
rules - the rules that will be applied during iterationstartPath - if "", all roots will be used, otherwise starts at the provided pathpublic File getNextFile() throws IOException
null if the iterator has completed the iteration of the file system.
This method is internally synchronized and is thread-safe.IOExceptionpublic int getNextFiles(File[] files, int batchSize) throws IOException
IOExceptionprotected String[] getFilesystemRoots() throws IOException
IOExceptionprotected boolean isFilesystemRoot(String filename) throws IOException
IOExceptionpublic Iterator<String> getFilenameIterator() throws IOException
IOExceptionpublic String getStartPath()
public boolean isPreorder()
public boolean isSorted()
public int compareTo(FilesystemIterator other)
compareTo in interface Comparable<FilesystemIterator>Copyright © 2000–2016 AO Industries, Inc.. All rights reserved.