Class FileStreamer
- java.lang.Object
-
- com.webcodepro.applecommander.util.filestreamer.FileStreamer
-
public class FileStreamer extends java.lang.Object
FileStreamer is utility class that will (optionally) recurse through all directories and feed a Java Stream of useful directory walking detail (disk, directory, file, and the textual path to get there).Sample usage:
FileStreamer.forDisk(image) .ignoreErrors(true) .stream() .filter(this::fileFilter) .forEach(fileHandler);
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FileStreamer
afterDisk(java.util.function.Consumer<FormattedDisk> consumer)
FileStreamer
beforeDisk(java.util.function.Consumer<FormattedDisk> consumer)
protected boolean
deletedFileFilter(FileTuple tuple)
static FileStreamer
forDisk(Disk disk)
static FileStreamer
forDisk(java.io.File file)
static FileStreamer
forDisk(java.lang.String fileName)
static FileStreamer
forFormattedDisks(FormattedDisk... disks)
protected boolean
globFilter(FileTuple tuple)
FileStreamer
ignoreErrors(boolean flag)
FileStreamer
includeDeleted(boolean flag)
FileStreamer
includeTypeOfFile(TypeOfFile type)
java.util.Iterator<FileTuple>
iterator()
FileStreamer
matchGlobs(java.lang.String... globs)
FileStreamer
matchGlobs(java.util.List<java.lang.String> globs)
FileStreamer
recursive(boolean flag)
java.util.stream.Stream<FileTuple>
stream()
-
-
-
Method Detail
-
forDisk
public static FileStreamer forDisk(java.io.File file) throws java.io.IOException, DiskUnrecognizedException
- Throws:
java.io.IOException
DiskUnrecognizedException
-
forDisk
public static FileStreamer forDisk(java.lang.String fileName) throws java.io.IOException, DiskUnrecognizedException
- Throws:
java.io.IOException
DiskUnrecognizedException
-
forDisk
public static FileStreamer forDisk(Disk disk) throws DiskUnrecognizedException
- Throws:
DiskUnrecognizedException
-
forFormattedDisks
public static FileStreamer forFormattedDisks(FormattedDisk... disks)
-
ignoreErrors
public FileStreamer ignoreErrors(boolean flag)
-
recursive
public FileStreamer recursive(boolean flag)
-
matchGlobs
public FileStreamer matchGlobs(java.util.List<java.lang.String> globs)
-
matchGlobs
public FileStreamer matchGlobs(java.lang.String... globs)
-
includeTypeOfFile
public FileStreamer includeTypeOfFile(TypeOfFile type)
-
includeDeleted
public FileStreamer includeDeleted(boolean flag)
-
beforeDisk
public FileStreamer beforeDisk(java.util.function.Consumer<FormattedDisk> consumer)
-
afterDisk
public FileStreamer afterDisk(java.util.function.Consumer<FormattedDisk> consumer)
-
stream
public java.util.stream.Stream<FileTuple> stream()
-
iterator
public java.util.Iterator<FileTuple> iterator()
-
deletedFileFilter
protected boolean deletedFileFilter(FileTuple tuple)
-
globFilter
protected boolean globFilter(FileTuple tuple)
-
-