GithubHelp home page GithubHelp logo

xclouded / corepatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lizhangqu/corepatch

0.0 1.0 0.0 54.21 MB

An universal patch generator and applier such as using BsDiff/BsPatch and Google Archive Patch

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%

corepatch's Introduction

CorePatch

An universal patch generator and applier such as using BsDiff/BsPatch and Google Archive Patch.

Changelog

See details in CHANGELOG.

Examples

I have provided a sample. It is based on unit test.

See sample here on Github.

To run the test cases, simply clone this repository, use android studio to compile and run

Usage

Dependency

gradle

dependencies {
    //for generator
    compile "io.github.lizhangqu:corepatch-core-generator:1.0.4"
    //for applier
    compile "io.github.lizhangqu:corepatch-core-applier:1.0.4"
}

maven

//for generator
<dependencies>
    <dependency>
      <groupId>io.github.lizhangqu</groupId>
      <artifactId>corepatch-core-generator</artifactId>
      <version>1.0.4</version>
    </dependency>
</dependencies>

//for applier
<dependencies>
    <dependency>
      <groupId>io.github.lizhangqu</groupId>
      <artifactId>corepatch-core-applier</artifactId>
      <version>1.0.4</version>
    </dependency>
</dependencies>

Generator

//get generator

Generator generator = CoreGenerator.getInstance().getGenerator(CoreGeneratorType.BS);
//Generator generator = CoreGenerator.getInstance().getGenerator(CoreGeneratorType.ARCHIVE);
//Generator generator = CoreGenerator.getInstance().getGenerator(CoreGeneratorType.TOTAL);
//Generator generator = CoreGenerator.getInstance().getGenerator("BS");
//Generator generator = CoreGenerator.getInstance().getGenerator("ARCHIVE");
//Generator generator = CoreGenerator.getInstance().getGenerator("TOTAL");

//generate

generator.generate(oldFile, newFile, toGeneratedPatchFile);
//generator.generate(oldFile, newFile, toGeneratedPatchOutputStream);

//md5

String md5 = generator.calculateMD5(toGeneratedPatchFile);

Applier

//get applier

 Applier applier = CoreApplier.getInstance().getApplier(CoreApplierType.BS);
//Applier applier = CoreApplier.getInstance().getApplier(CoreApplierType.ARCHIVE);
//Applier applier = CoreApplier.getInstance().getApplier(CoreApplierType.TOTAL);
//Applier applier = CoreApplier.getInstance().getApplier("BS");
//Applier applier = CoreApplier.getInstance().getApplier("ARCHIVE");
//Applier applier = CoreApplier.getInstance().getApplier("TOTAL");

//apply

applier.apply(oldFile, pacthFile, toGeneratedNewFile);
//applier.apply(oldFile, pacthInputStream, toGeneratedNewOutputStream);

//md5
String md5 = applier.calculateMD5(toGeneratedNewFile);

License

CorePatch is under the BSD license. See the LICENSE file for details.

corepatch's People

Contributors

lizhangqu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.