commit | ba063191e3473e773229ae1ec5edeaf6b91762d5 | [log] [tgz] |
---|---|---|
author | Jorge Saldivar <jorgesaldivar@google.com> | Wed Dec 21 16:28:11 2022 +0000 |
committer | Jorge Saldivar <jorgesaldivar@google.com> | Wed Dec 21 16:31:57 2022 +0000 |
tree | 7a40ce4161e5f2fd053a042356befaca658713a1 | |
parent | a3d21b2d84162c058831ae2f1b769c8549e8265c [diff] |
Remove test_mainline_module on CborJavaTestCases Bug: 263308389 Cbor tests don't need a mainline module to verify the test outcome. The library is a stand alone library which doesn't require installing a mainline module. Test: atest CborJavaTestCases Change-Id: Ie24988f2c223789e52423ea0d5b5b9c75864f65d
A Java 7 implementation of RFC 7049: Concise Binary Object Representation (CBOR)
Add this to the dependencies section of your pom.xml file:
<dependency> <groupId>co.nstant.in</groupId> <artifactId>cbor</artifactId> <version>0.8</version> </dependency>
ByteArrayOutputStream baos = new ByteArrayOutputStream(); new CborEncoder(baos).encode(new CborBuilder() .add("text") // add string .add(1234) // add integer .add(new byte[] { 0x10 }) // add byte array .addArray() // add array .add(1) .add("text") .end() .build()); byte[] encodedBytes = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(encodedBytes); List<DataItem> dataItems = new CborDecoder(bais).decode(); for(DataItem dataItem : dataItems) { // process data item }
ByteArrayInputStream bais = new ByteArrayInputStream(encodedBytes); new CborDecoder(bais).decode(new DataItemListener() { @Override public void onDataItem(DataItem dataItem) { // process data item } });
This project uses the C4 process for all code changes.
Copyright 2013-2017 Constantin Rack 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.