public class DirectoryTransformer extends java.lang.Object implements FileTransformer
FileTransformer.Mode| Modifier and Type | Field and Description |
|---|---|
static java.text.Collator |
DEFAULT_MEMBER_NAME_COMPARATOR
Sorts ascendingly by name (for the default locale).
|
NOT_IDENTICAL, THROW_NOT_IDENTICAL| Constructor and Description |
|---|
DirectoryTransformer(FileTransformer regularFileTransformer,
java.util.Comparator<java.lang.Object> directoryMemberNameComparator,
FileTransformer directoryMemberTransformer,
FileTransformations.DirectoryCombiner directoryCombiner,
boolean saveSpace,
boolean keepOriginals,
ExceptionHandler<java.io.IOException> exceptionHandler) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
toString() |
void |
transform(java.lang.String path,
java.io.File in,
java.io.File out,
FileTransformer.Mode mode)
If
in is not a directory, then the regularFileTransformer is invoked. |
public static final java.text.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 java.util.Comparator<java.lang.Object> directoryMemberNameComparator, FileTransformer directoryMemberTransformer, FileTransformations.DirectoryCombiner directoryCombiner, boolean saveSpace, boolean keepOriginals, ExceptionHandler<java.io.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(java.lang.String path,
java.io.File in,
java.io.File out,
FileTransformer.Mode mode)
throws java.io.IOException
in is not a directory, then the regularFileTransformer is invoked.
Otherwise, out is taken as a directory (created if missing), and directoryMemberTransformer.transform() is called for each member of
in.
If that throws an IOException or a RuntimeException, then that exception is caught, and exceptionHandler.handle() is called.
If that method completes normally (i.e. it doesn't throw an exception), then processing continues with the next
member of directory in.
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.CHECKjava.io.IOExceptionFileTransformer.NOT_IDENTICAL,
FileTransformer.Mode.TRANSFORM,
FileTransformer.Mode.CHECK,
FileTransformer.Mode.CHECK_AND_TRANSFORMpublic java.lang.String toString()
toString in class java.lang.Object