GithubHelp home page GithubHelp logo

valaphee / jackson-dataformat-nbt Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 192 KB

Support for reading and writing NBT-encoded data via Jackson abstractions.

License: Apache License 2.0

Kotlin 100.00%
jackson jackson-databind nbt nbt-parser nbt-format nbt-data

jackson-dataformat-nbt's Introduction

Overview

Jackson (Java) data format module that supports reading and writing NBT ("Named Binary Tag") 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).

Dependency

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

<dependency>
  <groupId>com.valaphee</groupId>
  <artifactId>jackson-dataformat-nbt</artifactId>
  <version>1.1.8</version>
</dependency>

and for Gradle-based projects:

implementation("com.valaphee:jackson-dataformat-nbt:1.1.8")

Usage

Basic usage is by using NbtFactory in places where you would usually use JsonFactory

ObjectMapper mapper = new ObjectMapper(new NbtFactory())
        .registerModule(new SimpleModule().addAbstractTypeMapping(Map.class, DeepEqualsLinkedHashMap.class))
        .addHandler(EmbeddedObjectDeserializationProblemHandler.INSTANCE);
// and then read/write data as usual
SomeType value = ...;
byte[] nbtData = mapper.writeValueAsBytes(value);
SomeType otherValue = mapper.readValue(nbtData, SomeType.class);

Implementation allows use of any of 3 main operating modes:

  • Streaming API (NbtParser and NbtGenerator)
  • 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).

jackson-dataformat-nbt's People

Contributors

valaphee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.