Skip to content

Commit

Permalink
Start with cbor
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 3, 2016
0 parents commit 3d7de83
Show file tree
Hide file tree
Showing 29 changed files with 58,317 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Do not merge `pom.xml` from older version, as it will typically conflict

pom.xml merge=ours
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# use glob syntax.
syntax: glob
*.class
*~
*.bak
*.off
*.old
.DS_Store

# building
target

# Eclipse
.classpath
.project
.settings

# IDEA
*.iml
*.ipr
*.iws
.idea/
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Overview

This is a multi-module umbrella project for [Jackson](../../../jackson)
standard binary dataformat backends.

Currently included are:

* [CBOR](cbor/)

## License

All modules are licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt).

## Status

[![Build Status](https://travis-ci.org/FasterXML/jackson-base-modules.svg)](https://travis-ci.org/FasterXML/jackson-dataformats-binary)

## More

See [Wiki](../../wiki) for more information (javadocs).
60 changes: 60 additions & 0 deletions cbor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## Overview

[Jackson](/FasterXML/jackson) (Java) data format module that supports reading and writing
[CBOR](https://www.rfc-editor.org/info/rfc7049)
("Concise Binary Object Representation") encoded data.
Module extends standard Jackson streaming API (`JsonFactory`, `JsonParser`, `JsonGenerator`), and as such works seamlessly with all the higher level data abstractions (data binding, tree model, and pluggable extensions).

## Status

As of version 2.4.0, this module is considered stable and production quality. Similar to JSON- and other JSON-like
backends, it implementsfull support for all levels (streaming, data-binding, tree model).

[![Build Status](https://travis-ci.org/FasterXML/jackson-dataformat-cbor.svg?branch=master)](https://travis-ci.org/FasterXML/jackson-dataformat-cbor)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor/)
[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor/badge.svg)](http://www.javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor)

### Limitations

Minor limitations exist with respect to advanced type-handling of `CBOR` format:

* While tags are written for some types (`BigDecimal`, `BigInteger`), they are not handling on parsing

# Maven dependency

To use this extension on Maven-based projects, use following dependency:

```xml
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.4.0</version>
</dependency>
```

(or whatever version is most up-to-date at the moment)

## Usage

Basic usage is by using `CborFactory` in places where you would usually use `JsonFactory`:

```java
CBORFactory f = new CBORFactory();
ObjectMapper mapper = new ObjectMapper(f);
// and then read/write data as usual
SomeType value = ...;
byte[] cborData = mapper.writeValueAsBytes(value);
SomeType otherValue = mapper.readValue(cborData, SomeType.class);
```

Implementation allows use of any of 3 main operating modes:

* Streaming API (`CBORParser` and `CBORGenerator`)
* Databinding (via `ObjectMapper` / `ObjectReader` / `ObjectWriter`)
* Tree Model (using `TreeNode`, or its concrete subtype, `JsonNode` -- not JSON-specific despite the name)

and all the usual data-binding use cases exactly like when using `JSON` or `Smile` (2 canonical 100% supported Jackson data formats).

# Documentation

* [Wiki](../../wiki) (includes Javadocs)
63 changes: 63 additions & 0 deletions cbor/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformats-binary</artifactId>
<version>2.8.0-SNAPSHOT</version>
</parent>
<artifactId>jackson-dataformat-cbor</artifactId>
<name>Jackson dataformat: CBOR</name>
<packaging>bundle</packaging>
<description>Support for reading and writing Concise Binary Object Representation
([CBOR](https://www.rfc-editor.org/info/rfc7049)
encoded data using Jackson abstractions (streaming API, data binding, tree model)
</description>
<url>http://github.com/FasterXML/jackson-dataformats-binary</url>

<properties>
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/dataformat/cbor</packageVersion.dir>
<packageVersion.package>${project.groupId}.cbor</packageVersion.package>
<!--
| Default onfiguration properties for the OSGi maven-bundle-plugin work ok
-->
</properties>

<dependencies>
<!-- Extends Jackson core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${version.jackson.core}</version>
</dependency>

<!-- and for testing we need databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
35 changes: 35 additions & 0 deletions cbor/release-notes/CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Here are people who have contributed to development of this project
(version numbers in brackets indicate release in which the problem was fixed)

Tatu Saloranta, [email protected]: author

Clinton Gormley (clintongormley@github)

* Suggested [#5]: Support binary (byte[]) Object keys (assuming UTF-8 encoding)
(2.4.3)
* Suggested [#6]: Support 'self-describe' CBOR tag
(2.4.3)

mbaril@github)

* Reported #9, suggested fix, contributed unit test: Infinite loop when trying
to write binary data using CBORGenerator
(2.5.1)

Steve Gury (stevegury@github)

* Reported #13, suggested fix: Bug in boundary checking in the CBORParser
(2.6.2)

Adrien Grand (jpountz@github)

* Reported #15: CBORParser.getNumberType returns DOUBLE even if the generator
has been fed with a float
(2.6.5)

philipa@githubL

* Requested #20: Add a public `finishToken()`
(2.7.2)
* Requested #22: CBORGenerator.copyCurrentStructure() and copyCurrentEvent() do not copy tags
(2.7.2)
104 changes: 104 additions & 0 deletions cbor/release-notes/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
Project: jackson-dataformat-cbor

------------------------------------------------------------------------
=== Releases ===
------------------------------------------------------------------------

2.8.0 (not yet released)

No changes since 2.7

2.7.4 (29-Apr-2016)
2.7.3 (16-Mar-2016)

No changes since 2.7.2

2.7.2 (27-Feb-2016)

#20: Add a public `finishToken()`
(requested by philipa@github)
#22: CBORGenerator.copyCurrentStructure() and copyCurrentEvent() do not copy tags
(requested by philipa@github)
- Change build to produce JDK6-compatible jar, to allow use on JDK6 runtime

2.7.1 (02-Feb-2016)

#19: Fix reported location after non-stream input has been parsed.
(contributed by philipa@github)

2.7.0 (10-Jan-2016)

#14: Add support for dynamically changing `CBORGenerator.Feature`s

2.6.6 (not yet released)

#18: Correct parsing of zero length byte strings
(reported, fix suggested by philipa@github)

2.6.5 (19-Jan-2016)

#15: CBORParser.getNumberType returns DOUBLE even if the generator has been fed with a float
(reported by Adrien G)

2.6.4 (07-Dec-2015)
2.6.3 (12-Oct-2015)

No changes since 2.6.2

2.6.2 (15-Sep-2015)

#13: Bug in boundary checking in the CBORParser
(reported by Steve G)

2.6.1 (09-Aug-2015)
2.6.0 (19-Jul-2015)

No changes since 2.5

2.5.5 (07-Dec-2015)
2.5.4 (09-Jun-2015)
2.5.3 (24-Apr-2015)
2.5.2 (29-Mar-2015)

No changes since 2.5.1.

2.5.1 (06-Feb-2015)

#9: Infinite loop when trying to write binary data using CBORGenerator
(reported by mbaril@github)

2.5.0 (01-Jan-2015)

#4: Implement `nextFieldName()` efficiently

2.4.6 (not yet released)

2.4.5 (13-Jan-2015)
2.4.4 (24-Nov-2014)
2.4.3 (04-Oct-2014)

No changes.

2.4.2 (15-Aug-2014)

#5: Support binary (byte[]) Object keys (assuming UTF-8 encoding)
(suggested by Clinton G, clintongormley@github)
#6: Support 'self-describe' CBOR tag
(suggested by Clinton G, clintongormley@github)

2.4.1 (17-Jun-2014)

- Minor performance improvement wrt `writeFieldName(SerializableString)`

2.4.0 (02-Jun-2014)

No functional changes since 2.3.x.

2.3.3 (10-Apr-2014)

#2: Negative Long values written as zero
(reported by gjesse@github)

2.3.2 (01-Mar-2014)

The very first public version!
Loading

0 comments on commit 3d7de83

Please sign in to comment.