public class PatchContentsTransformer extends PatchTextTransformer implements de.unkrig.commons.file.contentstransformation.ContentsTransformer
ContentsTransformer
that applies a patch in NORMAL, CONTEXT or UNIFIED DIFF format.PatchTextTransformer.Condition
Constructor and Description |
---|
PatchContentsTransformer(Charset inputCharset,
Charset outputCharset,
File patchFile,
Charset patchFileCharset,
PatchTextTransformer.Condition condition)
Parses a DIFF document from
patchFile . |
Modifier and Type | Method and Description |
---|---|
void |
transform(String path,
InputStream is,
OutputStream os)
Applies all patches to the input stream and writes the result into the output stream.
|
addHunkListener, isIdentity, transform
public PatchContentsTransformer(Charset inputCharset, Charset outputCharset, File patchFile, Charset patchFileCharset, PatchTextTransformer.Condition condition) throws IOException, de.unkrig.commons.text.StringStream.UnexpectedElementException
patchFile
. If it describes more than on DiffParser.Differential
, then all but
the first differential are ignored.
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 documentIOException
DiffParser.parse(java.io.Reader)
public void transform(String path, InputStream is, OutputStream os) throws IOException
transform
in interface de.unkrig.commons.file.contentstransformation.ContentsTransformer
IOException
Copyright © 2022 Arno Unkrig. All rights reserved.