/java-multicodec

Multicodec implementation in Java

Primary LanguageJavaMIT LicenseMIT

java-multicodec

A Java implementation of multicodec.
Supported codecs: See table

Install

Simply clone this repository.

Usage

boolean b = Multicodec.isCodec(someCodecName);

ByteBuffer prefix = Mutlicodec.getPrefix(someCodecName);

ByteBuffer data;
// put some data in the byteBuffer
ByteBuffer prefixedData = Multicodec.addPrefix(someCodecName, data);
ByteBuffer prefix = Multicodec.extractPrefix(prefixedData);
ByteBuffer originalData = Multicodec.removePrefix(prefixedData);
String codec = Multicodec.getCodec(prefixedData);

Dependency

You can use this project by building the JAR file as specified below, or by using JitPack (also supporting Gradle, SBT, etc).

for Maven, you can add the following sections to your POM.XML:

<repositories>
  <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.github.AliabbasMerchant</groupId>
    <artifactId>java-multicodec</artifactId>
    <version>$LATEST_VERSION</version>
  </dependency>
</dependencies>

Testing

Ant

ant test

Maven

mvn test

Building

Ant

ant dist will build a JAR file in the ./dist suitable for manual inclusion in a project. Dependent libraries are included in ./dist/lib.

Maven

mvn package will build a JAR file with Maven dependency information.

Releasing

The version number is specified in build.xml and pom.xml and must be changed in both places in order to be accurately reflected in the JAR file manifest. A git tag must be added in the format "vx.x.x" for JitPack to work.

Maintainers

Aliabbas Merchant.

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2019 Aliabbas Merchant