commit | 6fe119cbcad5036893ae53fabf6b4588ad92e960 | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Fri Apr 10 04:13:46 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Apr 10 04:13:46 2020 +0000 |
tree | 064efb59da2f232f7f5d0c211488e9138df1947b | |
parent | 7387324563a0f0861d08640b815de15c969df2bf [diff] | |
parent | 8f62076b7b05b47cdf3fc214e50c800e8edb298c [diff] |
[automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp into stag-aosp-master am: 3d7fde33f9 -s ours am: b9fa2d4216 am: 035e7b349e am: 8f62076b7b -s ours am skip reason: subject contains skip directive Change-Id: I1779fe5da8deef77588b4e40326e45e29e0a23eb
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.