CborTree

A Java API for decoding, manipulating, and encoding CBOR data items.

Лицензия

Лицензия

Группа

Группа

com.google.iot.cbor
Идентификатор

Идентификатор

cbor
Последняя версия

Последняя версия

0.01.02
Дата

Дата

Тип

Тип

jar
Описание

Описание

CborTree
A Java API for decoding, manipulating, and encoding CBOR data items.
Ссылка на сайт

Ссылка на сайт

https://github.com/google/cbortree
Система контроля версий

Система контроля версий

https://github.com/google/cbortree

Скачать cbor

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.google.iot.cbor/cbor/ -->
<dependency>
    <groupId>com.google.iot.cbor</groupId>
    <artifactId>cbor</artifactId>
    <version>0.01.02</version>
</dependency>
// https://jarcasting.com/artifacts/com.google.iot.cbor/cbor/
implementation 'com.google.iot.cbor:cbor:0.01.02'
// https://jarcasting.com/artifacts/com.google.iot.cbor/cbor/
implementation ("com.google.iot.cbor:cbor:0.01.02")
'com.google.iot.cbor:cbor:jar:0.01.02'
<dependency org="com.google.iot.cbor" name="cbor" rev="0.01.02">
  <artifact name="cbor" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.google.iot.cbor', module='cbor', version='0.01.02')
)
libraryDependencies += "com.google.iot.cbor" % "cbor" % "0.01.02"
[com.google.iot.cbor/cbor "0.01.02"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.json : json jar 20180130
org.checkerframework : checker-qual jar 2.5.6
com.google.code.findbugs : jsr305 jar 3.0.2
com.google.errorprone : error_prone_annotations jar 2.2.0

test (2)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.3.1
org.junit.jupiter : junit-jupiter-engine jar 5.3.1

Модули Проекта

Данный проект не имеет модулей.

CborTree

CborTree is a Java library for encoding/decoding CBOR data items to/from a convenient object representation. It can also be used to convert to/from JSON and standard Java object representations.

Features

  • Full support for RFC7049
  • Partial streaming support via CoapReader and CoapWriter
  • Supports easy conversions...
    • ...to/from standard Java objects/collections/maps via toJavaObject() method
    • ...to JSON representation via toJsonString() method
    • ...to/from JSONObject/JSONArray objects (from the common org.json API)
  • Supports BigInteger
  • Supports reading and writing half (16-bit) floating-point numbers
  • RFC7049 diagnostic notation available via toString()

Current Limitations

  • Multiple tags on a single data item are not supported
  • Tags currently are limited to values no larger than Integer.MAX_VALUE (2,147,483,647).

Planned Features

  • Canonicalization as described in RFC7049 Section 3.9
  • Bytecode builder for directly generating CBOR bytecode without an intermediate object representation
  • Object builder for more easily generating CborObject trees than via manual creation.

Documentation

Example

byte[] cborBytes = new byte[] { (byte)0xd9, (byte)0xd9, (byte)0xf7,
                                (byte)0xa2, 0x61, 0x61, 0x01, 0x61,
                                0x62, (byte)0x82, 0x02, 0x03 };

CborMap cborMap = CborMap.createFromCborByteArray(cborBytes);

// Prints out the line `toString: 55799({"a":1,"b":[2,3]})`
System.out.println("toString: " + cborMap);

// Prints out the line `toJsonString: {"a":1,"b":[2,3]}`
System.out.println("toJsonString: " + cborMap.toJsonString());

CborArray cborArray = (CborArray)cborMap.get("b");

float sum = 0;

// Prints out `b: 2` and `b: 3`
for (CborObject obj : cborArray) {
    System.out.println("b: " + obj);

    if (obj instanceof CborNumber) {
        sum += ((CborNumber)obj).floatValue();
    }
}

// Prints out `Sum: 5.0`
System.out.println("Sum: " + sum);

Building and Installing

This project uses Maven for building. Once Maven is installed, you should be able to build and install the project by doing the following:

mvn verify
mvn install

Adding to Projects

Gradle:

dependencies {
  compile 'com.google.iot.cbor:cbor:0.01.02'
}

Maven:

<dependency>
  <groupId>com.google.iot.cbor</groupId>
  <artifactId>cbor</artifactId>
  <version>0.01.02</version>
</dependency>

License

CborTree is released under the Apache 2.0 license.

Copyright 2018 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Disclaimer

This is not an officially supported Google product.

com.google.iot.cbor

Google

Google ❤️ Open Source

Версии библиотеки

Версия
0.01.02
0.01.01
0.01.00