https://github.com/ipld/java-ipld-cbor
A Java implementation of the IPLD cbor format
https://github.com/ipld/java-ipld-cbor
Last synced: 10 months ago
JSON representation
A Java implementation of the IPLD cbor format
- Host: GitHub
- URL: https://github.com/ipld/java-ipld-cbor
- Owner: ipld
- License: mit
- Created: 2018-05-27T22:53:43.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-05-01T07:32:52.000Z (about 1 year ago)
- Last Synced: 2025-05-01T08:29:41.423Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 25.4 KB
- Stars: 12
- Watchers: 5
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# java-ipld-cbor
[](http://ipn.io)
[](http://github.com/ipld/ipld)
[](http://webchat.freenode.net/?channels=%23ipfs)
> A Java implementation of the IPLD cbor format
This is the [ipld](https://github.com/ipld/ipld) serialization implementation in Java.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Dependency](#dependency)
- [Testing](#testing)
- [Building](#building)
- [Releasing](#releasing)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)
## Install
Simply clone this repo.
## Usage
```java
// Serialization
List list = new ArrayList<>();
list.add(new CborObject.CborString("A value"));
list.add(new CborObject.CborByteArray("A value".getBytes()));
list.add(new CborObject.CborNull());
list.add(new CborObject.CborBoolean(true));
CborObject.CborList cborList = new CborObject.CborList(list);
byte[] raw = cborList.toByteArray();
// Deserialization
CborObject deserialized = CborObject.fromByteArray(raw);
// Custom classes can implement Cborable to implement their own cbor format (with a corresponding static fromCbor method)
```
## Dependency
You can use this project by building the JAR file as specified below, or by using [JitPack](https://jitpack.io/#ipld/java-ipld-cbor/) (also supporting Gradle, SBT, etc).
for Maven, you can add the follwing sections to your POM.XML:
```xml
jitpack.io
https://jitpack.io
com.github.ipld
java-ipld-cbor
v1.0.0
```
## Testing
`mvn test`
## Building
`mvn package` will build a JAR file with Maven dependency information.
## Releasing
The version number is specified in the `pom.xml` file and must be changed 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
Captain: [@ianopolous](https://github.com/ianopolous).
## Contribute
Contributions welcome. Please check out [the issues](https://github.com/ipld/java-ipld-cbor/issues).
Check out our [contributing document](https://github.com/ipld/ipld/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to IPLD are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
[MIT](LICENSE) © 2016 Ian Preston, Christopher Boddy
[Apache v2] © 2013 J.W. Janssen