public class Patch extends Object
Constructor and Description |
---|
Patch() |
Modifier and Type | Method and Description |
---|---|
void |
addAddition(de.unkrig.commons.lang.protocol.Predicate<? super String> condition,
String name,
File contents) |
de.unkrig.commons.file.contentstransformation.ContentsTransformer |
addContentsTransformation(de.unkrig.commons.lang.protocol.Predicate<? super String> pathPredicate,
de.unkrig.commons.file.contentstransformation.ContentsTransformer contentsTransformer)
For each file and ZIP entry, the first matching
Patch.ContentsTransformation takes
effect. |
void |
addRemoval(de.unkrig.commons.lang.protocol.Predicate<? super String> removal)
Configures that files and ZIP entries who's pathes match the
removal will be removed. |
void |
addRenaming(de.unkrig.commons.text.pattern.Glob value)
Configures that files and ZIP entries which match the
removal will be renamed. |
de.unkrig.commons.file.contentstransformation.ContentsTransformer |
contentsTransformer() |
de.unkrig.commons.file.filetransformation.FileTransformer |
fileTransformer(boolean lookIntoDirectories,
boolean renameOrRemoveTopLevelFiles) |
de.unkrig.commons.file.ExceptionHandler<IOException> |
getExceptionHandler() |
void |
setDirectoryMemberNameComparator(Comparator<Object> directoryMemberNameComparator) |
void |
setExceptionHandler(de.unkrig.commons.file.ExceptionHandler<IOException> exceptionHandler)
Sets the exception handler.
|
void |
setKeepOriginals(boolean value)
Whether to keep backup copies of files/entries that are modified or removed.
|
void |
setLookIntoFormat(de.unkrig.commons.lang.protocol.Predicate<? super String> value)
For any archive contents, instead of the 'raw' contents, the contents of the archive entries are
processed iff the string
" archive-format: archive-path"
matches the given predicate. |
void |
setSaveSpace(boolean value)
Whether to transfor directory trees file-by-file (
true , or to create a temporary copy of the entire
directory tree (false ). |
public void setSaveSpace(boolean value)
true
, or to create a temporary copy of the entire
directory tree (false
). With the latter option chances are bigger that the original files can be
reverted in case of an exception.
Only relevant for in-place transformations.
public void setKeepOriginals(boolean value)
false
.public void setLookIntoFormat(de.unkrig.commons.lang.protocol.Predicate<? super String> value)
"
archive-format:
archive-path"
matches the given predicate.
For any compressed contents, instead of the 'raw' contents, the expanded contents is processed iff the string
"
compression-format:
compressed-path"
matches the given predicate.
The default is PredicateUtil.always()
.
ArchiveFormatFactory.allFormats()
,
CompressionFormatFactory.allFormats()
public void setDirectoryMemberNameComparator(@Nullable Comparator<Object> directoryMemberNameComparator)
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 thempublic de.unkrig.commons.file.ExceptionHandler<IOException> getExceptionHandler()
public void setExceptionHandler(de.unkrig.commons.file.ExceptionHandler<IOException> exceptionHandler)
ExceptionHandler.defaultHandler()
.public de.unkrig.commons.file.contentstransformation.ContentsTransformer addContentsTransformation(de.unkrig.commons.lang.protocol.Predicate<? super String> pathPredicate, de.unkrig.commons.file.contentstransformation.ContentsTransformer contentsTransformer)
Patch.ContentsTransformation
takes
effect.public void addRemoval(de.unkrig.commons.lang.protocol.Predicate<? super String> removal)
removal
will be removed.public void addRenaming(de.unkrig.commons.text.pattern.Glob value)
removal
will be renamed. Multiple renamings are
applied in order, i.e. "a=b", "b=c" is effectively "a=c".public void addAddition(de.unkrig.commons.lang.protocol.Predicate<? super String> condition, String name, File contents)
condition
- Applied to each directory or archive path; determines whether the contents will be addedname
- File name or archive entry name to addcontents
- Contents to addpublic de.unkrig.commons.file.filetransformation.FileTransformer fileTransformer(boolean lookIntoDirectories, boolean renameOrRemoveTopLevelFiles)
lookIntoDirectories
- Iff false
, then the returned FileTransformations
can solely
transform regular filesrenameOrRemoveTopLevelFiles
- Iff false
, then only files in subdirectories and archive entries are
renamed and/or removedFileTransformer
which executes directory tree / archive file /
compressed file traversal and executes the previously configured operationspublic de.unkrig.commons.file.contentstransformation.ContentsTransformer contentsTransformer()
ContentsTransformer
which implements compressed contents and archive traversal and executes
the previously configured operationsCopyright © 2022 Arno Unkrig. All rights reserved.