public class PatchEngine
extends java.lang.Object
PatchEngine
is the engine for creating, matching and applying
a PatchModel
to the context provided by a PatchContributor
.Constructor and Description |
---|
PatchEngine(PatchContributor toFileContributor)
Constructs a new
PatchEngine for the given contributor. |
PatchEngine(PatchStreamContributor toStream)
Constructs a new
PatchEngine for the given inputStream. |
Modifier and Type | Method and Description |
---|---|
void |
addPatchListener(PatchListener l)
Adds a listener to the engine for receiving
PatchEvent s. |
void |
applyModel(PatchModel patchModel,
PatchContext patchContext,
PatchApplyOptions applyOptions)
Applies the given
PatchModel to the engine's to-file contributor,
according to options. |
byte[] |
applyModelNoFiles(PatchModel patchModel,
PatchContext patchContext)
Applies the given
PatchModel to the engine's to-Stream contributor,
according to options. |
PatchModel |
createModel(PatchContributor fromFileContributor,
PatchCreateOptions createOptions)
Creates a
PatchModel based on differences between the given contributor
and the engine's to-file contributor, according to options. |
PatchModel |
createModel(PatchStreamContributor fromStream,
PatchCreateOptions createOptions)
Creates a
PatchModel based on differences between the given inputstream
and the engine's to input stream, according to options. |
static PatchEntry |
createPatchEntry(oracle.javatools.compare.algorithm.sequence.SequenceCompareModel compareModel) |
PatchContext |
matchModel(PatchModel patchModel,
PatchMatchOptions matchOptions)
Matches the given
PatchModel against the engine's to-file contributor,
according to options. |
PatchContext |
matchModelNoFiles(PatchModel patchModel,
PatchMatchOptions matchOptions) |
void |
removePatchListener(PatchListener l)
Removes a listener from the engine for receiving
PatchEvent s. |
PatchModel |
reverseModel(PatchModel patchModel,
java.lang.String fromFileBaseDirectoryPath)
Reverses the information contained in the given
PatchModel . |
public PatchEngine(PatchContributor toFileContributor)
PatchEngine
for the given contributor.toFileContributor
- the to-file (or single) contributor.public PatchEngine(PatchStreamContributor toStream)
PatchEngine
for the given inputStream.to
- InputStream.public void addPatchListener(PatchListener l)
PatchEvent
s.l
- the listener.public void removePatchListener(PatchListener l)
PatchEvent
s.l
- the listener.public PatchModel createModel(PatchStreamContributor fromStream, PatchCreateOptions createOptions) throws java.io.IOException, CompareFailedException
PatchModel
based on differences between the given inputstream
and the engine's to input stream, according to options.fromInputStream
- the from input stream.createOptions
- the patch creation options.java.io.IOException
- if an I/O exception occurred while reading from the InputStreamCompareFailedException
- if a file comparison failed.public PatchModel createModel(PatchContributor fromFileContributor, PatchCreateOptions createOptions) throws java.io.IOException, CompareFailedException
PatchModel
based on differences between the given contributor
and the engine's to-file contributor, according to options.fromFileContributor
- the from-file contributor.createOptions
- the patch creation options.java.io.IOException
- if an I/O exception occurred while reading a file.CompareFailedException
- if a file comparison failed.public PatchContext matchModelNoFiles(PatchModel patchModel, PatchMatchOptions matchOptions) throws java.io.IOException
java.io.IOException
public PatchContext matchModel(PatchModel patchModel, PatchMatchOptions matchOptions) throws java.io.IOException
PatchModel
against the engine's to-file contributor,
according to options.patchModel
- the patch model.matchOptions
- the patch match options.java.io.IOException
- if an I/O exception occurred while reading a file.public byte[] applyModelNoFiles(PatchModel patchModel, PatchContext patchContext) throws java.io.IOException
PatchModel
to the engine's to-Stream contributor,
according to options.patchModel
- the patch model.patchContext
- the context describing the match.java.io.IOException
- if an I/O exception occurred while creating, writing or reading a file.public void applyModel(PatchModel patchModel, PatchContext patchContext, PatchApplyOptions applyOptions) throws java.io.IOException
PatchModel
to the engine's to-file contributor,
according to options.patchModel
- the patch model.patchContext
- the context describing the match.applyOptions
- the patch apply options.java.io.IOException
- if an I/O exception occurred while creating, writing or reading a file.public PatchModel reverseModel(PatchModel patchModel, java.lang.String fromFileBaseDirectoryPath)
PatchModel
.patchModel
- the patch model.fromFileBaseDirectoryPath
- the from-file base directory path.public static final PatchEntry createPatchEntry(oracle.javatools.compare.algorithm.sequence.SequenceCompareModel compareModel)