public class DirectoryTransformer extends Object implements FileTransformer
FileTransformer.Mode| Modifier and Type | Field and Description |
|---|---|
static Collator |
DEFAULT_MEMBER_NAME_COMPARATOR
Sorts ascendingly by name (for the default locale).
|
NOT_IDENTICAL, THROW_NOT_IDENTICAL| Constructor and Description |
|---|
DirectoryTransformer(FileTransformer regularFileTransformer,
Comparator<Object> directoryMemberNameComparator,
FileTransformer directoryMemberTransformer,
FileTransformations.DirectoryCombiner directoryCombiner,
boolean saveSpace,
boolean keepOriginals,
ExceptionHandler<IOException> exceptionHandler) |
| Modifier and Type | Method and Description |
|---|---|
String |
toString() |
void |
transform(String path,
File in,
File out,
FileTransformer.Mode mode)
If in is a directory, then out is taken as a directory (created if missing), and
directoryMemberTransformer.transform() is called for each member of
in. |
public static final Collator DEFAULT_MEMBER_NAME_COMPARATOR
A good default value for the memberNameComparator parameter of DirectoryTransformer(FileTransformer, Comparator, FileTransformer, FileTransformations.DirectoryCombiner,
boolean, boolean, ExceptionHandler).
public DirectoryTransformer(FileTransformer regularFileTransformer, @Nullable Comparator<Object> directoryMemberNameComparator, FileTransformer directoryMemberTransformer, FileTransformations.DirectoryCombiner directoryCombiner, boolean saveSpace, boolean keepOriginals, ExceptionHandler<IOException> exceptionHandler)
directoryMemberNameComparator - The comparator used to sort a directory's members; a null value
means to NOT sort the members, i.e. leave them in their 'natural' order as
File.list() returns themFileTransformer.transform(String, File, File, Mode),
DEFAULT_MEMBER_NAME_COMPARATORpublic void transform(String path, File in, File out, FileTransformer.Mode mode) throws IOException
directoryMemberTransformer.transform() is called for each member of
in.
If that method throws an IOException or a RuntimeException, then that exception is caught, and
exceptionHandler.handle()
is called. (This includes the case when FileTransformer.NOT_IDENTICAL is thrown in mode FileTransformer.Mode.CHECK.)
If "exceptionHandler.ExceptionHandler.handle(String, RuntimeException)" completes
normally (i.e. it doesn't throw an exception), then processing continues with the next member of directory
in.
Iff in is not a directory, then the regularFileTransformer is invoked.
transform in interface FileTransformerpath - A text designating the input file; typically, but not necessarily identical with in.getPath()in - The input file to readout - The output file to create; irrelevant iff mode == FileTransformer.Mode.CHECKIOExceptionFileTransformer.NOT_IDENTICAL,
FileTransformer.Mode.TRANSFORM,
FileTransformer.Mode.CHECK,
FileTransformer.Mode.CHECK_AND_TRANSFORMCopyright © 2018 Arno Unkrig. All rights reserved.