{"id":22280910,"url":"https://github.com/peteroupc/cbor-java","last_synced_at":"2025-05-16T14:08:41.953Z","repository":{"id":21302206,"uuid":"24618517","full_name":"peteroupc/CBOR-Java","owner":"peteroupc","description":"A Java implementation of Concise Binary Object Representation (RFC 8949)","archived":false,"fork":false,"pushed_at":"2025-02-22T09:19:43.000Z","size":5264,"stargazers_count":46,"open_issues_count":1,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-13T19:17:14.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peteroupc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-30T00:40:15.000Z","updated_at":"2025-05-13T13:52:38.000Z","dependencies_parsed_at":"2022-07-27T02:17:18.510Z","dependency_job_id":"9df550b8-a0a7-479a-9792-76da0e65c0af","html_url":"https://github.com/peteroupc/CBOR-Java","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteroupc%2FCBOR-Java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteroupc%2FCBOR-Java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteroupc%2FCBOR-Java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteroupc%2FCBOR-Java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peteroupc","download_url":"https://codeload.github.com/peteroupc/CBOR-Java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T16:09:51.962Z","updated_at":"2025-05-16T14:08:36.943Z","avatar_url":"https://github.com/peteroupc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CBOR\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.upokecenter/cbor.svg?style=plastic)](https://search.maven.org/#search|ga|1|g%3A%22com.upokecenter%22%20AND%20a%3A%22cbor%22)\n\n---\n\nA Java implementation of Concise Binary Object Representation, a general-purpose binary data format defined in RFC 8949. According to that RFC, CBOR's data model \"is an extended version of the JSON data model\", supporting many more types of data than JSON. \"CBOR was inspired by MessagePack\", but \"is not intended as a version of or replacement for MessagePack.\"\n\nThis implementation was written by Peter O. and is released to the Public Domain under the [CC0 Declaration](https://creativecommons.org/publicdomain/zero/1.0/).\n\nThis implementation also doubles as a reader and writer of JSON, and can convert data from JSON to CBOR and back.\n\nFinally, this implementation supports arbitrary-precision binary and decimal floating-point numbers and rational numbers with arbitrary-precision components.\n\n## How to Install\n\nStarting with version 0.23.0, the Java implementation is available\nas an [artifact](https://search.maven.org/#search|ga|1|g%3A%22com.upokecenter%22%20AND%20a%3A%22cbor%22) in the Central Repository. To add this library to a Maven\nproject, add the following to the `dependencies` section in your `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.upokecenter\u003c/groupId\u003e\n  \u003cartifactId\u003ecbor\u003c/artifactId\u003e\n  \u003cversion\u003e5.0.0-alpha2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIn other Java-based environments, the library can be referred to by its\ngroup ID (`com.upokecenter`), artifact ID (`cbor`), and version, as given earlier.  A nonrelease version of this library is `5.0.0-alpha` rather than the version number given earlier.\n\n## Documentation\n\nThis library defines one class, called CBORObject, that allows you to read and\nwrite CBOR objects to and from data streams and byte arrays, and to convert JSON\ntext to CBOR objects and back.\n\n**See the [Java API documentation](https://peteroupc.github.io/CBOR/api/).**\n\n## Examples\n\nReading data from a file.\n\n```java\n // Java\n // Open the file stream\n try (FileInputStream stream = new FileInputStream(\"object.cbor\")) {\n    // Read the CBOR object from the stream\n    var cbor = CBORObject.Read(stream);\n    // At this point, the object is read, but the file stream might\n    // not have ended yet.  Here, the code may choose to read another\n    // CBOR object, check for the end of the stream, or just ignore the\n    // rest of the file.  The following is an example of checking for the\n    // end of the stream.\n    if (stream.getChannel().position() != stream.getChannel().size()) {\n      // The end of the stream wasn't reached yet.\n    } else {\n      // The end of the stream was reached.\n    }\n }\n```\n\nWriting multiple objects to a file, including arbitrary objects:\n\n```java\n// Java\n// This example uses the \"try-with-resources\" statement from Java 7.\n// This example writes different kinds of objects in CBOR\n// format to the same file.\ntry (FileOutputStream stream = new FileOutputStream(\"object.cbor\")) {\n   CBORObject.Write(true, stream);\n   CBORObject.Write(422.5, stream);\n   CBORObject.Write(\"some string\", stream);\n   CBORObject.Write(CBORObject.Undefined, stream);\n   CBORObject.NewArray().Add(42).WriteTo(stream);\n}\n```\n\nNOTE: All code samples in this section are released to the Public Domain,\nas explained in \u003chttps://creativecommons.org/publicdomain/zero/1.0/\u003e.\n\n## Source Code\n\nSource code is available in the [project page](https://github.com/peteroupc/CBOR-Java).\n\n## About\n\nWritten in 2013-2016 by Peter O.\n\nAny copyright to this work is released to the Public Domain.\nIn case this is not possible, this work is also\nlicensed under the Unlicense: [https://unlicense.org/](https://unlicense.org/)\n\n## Signing Key\n\nRelease versions, in the Central Repository, of the Java version of this library are signed with the following signing key.\n\n- ID: `Peter Occil (Maven key) \u003cpoccil14@gmail.com\u003e`\n- Fingerprint: 1A82D51407003717A4171AAC87522D618F2B2338\n\n## Release Notes\n\nFor release notes, see the [CBOR .NET repository](https://github.com/peteroupc/CBOR).\n\nThe [commit history](https://github.com/peteroupc/CBOR-Java/commits/master)\ncontains details on code changes in previous versions.\n\n## Acknowledgments\n\nFor acknowledgments, see the [CBOR .NET repository](https://github.com/peteroupc/CBOR).\n\nI thank all users who sent issues to this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeteroupc%2Fcbor-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeteroupc%2Fcbor-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeteroupc%2Fcbor-java/lists"}