Package one.tranic.t.utils
Class SimplePatcher
java.lang.Object
one.tranic.t.utils.SimplePatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutputStreamapplyPatch(InputStream patch, InputStream dst) Applies a patch to a target file and returns the resulting file as an output stream.static OutputStreamcreatePatch(InputStream src, InputStream dst) Creates a binary patch that transforms the contents of the source file into the destination file.
-
Constructor Details
-
SimplePatcher
public SimplePatcher()
-
-
Method Details
-
createPatch
Creates a binary patch that transforms the contents of the source file into the destination file.- Parameters:
src- the InputStream representing the source file's datadst- the InputStream representing the destination file's data- Returns:
- an OutputStream containing the binary patch data
- Throws:
IOException- if an I/O error occurs while reading from the input streams or writing to the patch
-
applyPatch
Applies a patch to a target file and returns the resulting file as an output stream.- Parameters:
patch- the input stream containing the patch data to be applieddst- the input stream of the target file that will be patched- Returns:
- an output stream containing the patched file contents
- Throws:
IOException- if an I/O error occurs while reading or writing streamsIllegalStateException- if the patch does not match the target file, is corrupted, or contains invalid commands
-