java高效序列化,MessagePack for Java 是一个高效的二进制序列化格式

MessagePack for Java

MessagePack is a binary serialization format. If you need a fast and compact alternative of JSON, MessagePack is your friend. For example, a small integer can be encoded in a single byte, and short strings only need a single byte prefix + the original byte array. MessagePack implementation is already available in various languages (See also the list in http://msgpack.org) and works as a universal data format.

MessagePack v7 (or later) is a faster implementation of the previous version v06, and supports all of the message pack types, including extension format.

Quick Start

68747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f6f72672e6d73677061636b2f6d73677061636b2d636f72652f62616467652e73766768747470733a2f2f6a617661646f632e696f2f62616467652f6f72672e6d73677061636b2f6d73677061636b2d636f72652e737667

For Maven users:

org.msgpack

msgpack-core

(version)

For sbt users:

libraryDependencies += "org.msgpack" % "msgpack-core" % "(version)"

For gradle users:

repositories {

mavenCentral()

}

dependencies {

compile 'org.msgpack:msgpack-core:(version)'

}

Integration with Jackson ObjectMapper (jackson-databind)

msgpack-java supports serialization and deserialization of Java objects through jackson-databind. For details, see msgpack-jackson/README.md. The template-based serialization mechanism used in v06 is deprecated.

For MessagePack Developers 68747470733a2f2f7472617669732d63692e6f72672f6d73677061636b2f6d73677061636b2d6a6176612e7376673f6272616e63683d7630372d646576656c6f70

msgpack-java uses sbt for building the projects. For the basic usage of sbt, see:

Coding style

Basic sbt commands

Enter the sbt console:

$ ./sbt

Here is a list of sbt commands for daily development:

> ~compile # Compile source codes

> ~test:compile # Compile both source and test codes

> ~test # Run tests upon source code change

> ~testOnly *MessagePackTest # Run tests in the specified class

> ~testOnly *MessagePackTest -- -n prim # Run the test tagged as "prim"

> project msgpack-core # Focus on a specific project

> package # Create a jar file in the target folder of each project

> findbugs # Produce findbugs report in target/findbugs

> jacoco:cover # Report the code coverage of tests to target/jacoco folder

> jcheckStyle # Run check style

> ;scalafmt;test:scalafmt;scalafmtSbt # Reformat Scala codes

Publishing

> publishLocal # Install to local .ivy2 repository

> publishM2 # Install to local .m2 Maven repository

> publish # Publishing a snapshot version to the Sonatype repository

> release # Run the release procedure (set a new version, run tests, upload artifacts, then deploy to Sonatype)

# If you need to perform the individual release steps manually, use the following commands:

> publishSigned # Publish GPG signed artifacts to the Sonatype repository

> sonatypeRelease # Publish to the Maven Central (It will be synched within less than 4 hours)

For publishing to Maven central, msgpack-java uses sbt-sonatype plugin. Set Sonatype account information (user name and password) in the global sbt settings. To protect your password, never include this file in your project.

$HOME/.sbt/(sbt-version)/sonatype.sbt

credentials += Credentials("Sonatype Nexus Repository Manager",

"oss.sonatype.org",

"(Sonatype user name)",

"(Sonatype password)")

Project Structure

msgpack-core # Contains packer/unpacker implementation that never uses third-party libraries

msgpack-jackson # Contains jackson-dataformat-java implementation

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值