public class PatchTextTransformer extends Object implements de.unkrig.commons.file.contentstransformation.TextTransformer
TextTransformer
that applies a patch in NORMAL, CONTEXT or UNIFIED DIFF format.Modifier and Type | Class and Description |
---|---|
static interface |
PatchTextTransformer.Condition |
Constructor and Description |
---|
PatchTextTransformer(List<DiffParser.Differential> differentials,
PatchTextTransformer.Condition condition,
int unused)
Use the first of the differentials.
|
PatchTextTransformer(List<DiffParser.Hunk> hunks,
PatchTextTransformer.Condition condition) |
Modifier and Type | Method and Description |
---|---|
void |
addHunkListener(de.unkrig.commons.lang.protocol.Consumer<DiffParser.Hunk> hunkListener) |
boolean |
isIdentity() |
void |
transform(String path,
Reader reader,
Writer writer)
Applies all patches to the
reader and writes the result to the writer . |
public PatchTextTransformer(List<DiffParser.Hunk> hunks, PatchTextTransformer.Condition condition)
condition
- Is evaluated for each hunk, and determines whether or not the hunk is
appliedde.unkrig.commons.text.StringStream.UnexpectedElementException
- The patchFile
does not contain a valid DIFF documentDiffParser.parse(java.io.Reader)
public PatchTextTransformer(List<DiffParser.Differential> differentials, PatchTextTransformer.Condition condition, int unused)
The file name information in the differential is ignored.
condition
- Is evaluated for each hunk, and determines whether or not the hunk is
appliedde.unkrig.commons.text.StringStream.UnexpectedElementException
- The patchFile
does not contain a valid DIFF documentDiffParser.parse(java.io.Reader)
public boolean isIdentity()
public void transform(String path, Reader reader, Writer writer) throws IOException
reader
and writes the result to the writer
.transform
in interface de.unkrig.commons.file.contentstransformation.TextTransformer
IOException
public void addHunkListener(de.unkrig.commons.lang.protocol.Consumer<DiffParser.Hunk> hunkListener)
Copyright © 2022 Arno Unkrig. All rights reserved.