Skip to content

danubetech/cborld-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cborld-java

Information

This is a work-in-progress implementation of CBOR-LD.

Not ready for production use! Use at your own risk! Pull requests welcome.

Maven

Build:

mvn clean install

Dependency:

<repositories>
	<repository>
		<id>danubetech-maven-public</id>
		<url>https://repo.danubetech.com/repository/maven-public/</url>
	</repository>
</repositories>

<dependency>
	<groupId>com.danubetech</groupId>
	<artifactId>cborld-java</artifactId>
	<version>1.1.0</version>
</dependency>

Example

Example code:

// encode to CBOR-LD

byte[] bytes = CborLdEncode.encode(jsonLdDocument, DOCUMENT_LOADER);
System.out.println(Hex.encodeHex(bytes));

// generate QR code

byte[] qrCode = CborLdQrCode.toQrCode(bytes);
File outputfile = new File("example-qrcode.png");
OutputStream out = new FileOutputStream(outputfile);
out.write(qrCode);
out.close();

// decode from CBOR-LD

Map<String, Object> decoded = (Map<String, Object>) CborLdDecode.decode(bytes, DOCUMENT_LOADER);

Example QR code:

https://github.com/danubetech/cborld-java/blob/main/docs/example-qrcode.png

About

Danube Tech - https://danubetech.com/


This software library is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 871932