Java serialization library, proto compiler, code generator
Java Other
Latest commit 2350507 Feb 8, 2018
Permalink
Failed to load latest commit information.
protostuff-api [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-benchmarks [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-bom [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-collectionschema [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-compiler [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-core [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-it [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-json [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-kvp [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-maven-plugin [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-msgpack [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-parser [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-runtime-md [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-runtime-registry [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-runtime-view [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-runtime [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-uberjar [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-xml [maven-release-plugin] prepare for next development iteration Jul 3, 2017
protostuff-yaml [maven-release-plugin] prepare for next development iteration Jul 3, 2017
.gitignore Added intellij files to gitignore Feb 20, 2014
.travis.yml Enable Travis automatic build testing. Feb 21, 2014
CHANGELOG.md Update CHANGELOG.md Apr 8, 2015
CONTRIBUTORS.md Update readme formatting Nov 7, 2014
LICENSE.txt apache 2 license Sep 30, 2009
NOTICE.txt #148: Fix unsigned number serialization for JsonInput/JsonOutput Feb 1, 2016
README.md docs Feb 8, 2018
pom.xml update links Feb 7, 2018
styleGuidelines.xml Reformat code Dec 14, 2014

README.md

Protostuff

A java serialization library with built-in support for forward-backward compatibility (schema evolution) and validation.

  • efficient, both in speed and memory
  • flexible, supporting pluggable formats

Usecase

  • messaging layer in RPC
  • storage format in the datastore or cache

For more information, go to https://protostuff.github.io/docs/

Usage

public final class Foo
{
    String name;
    int id;
    
    public Foo(String name, int id)
    {
        this.name = name;
        this.id = id;
    }
}

static void roundTrip()
{
    Foo foo = new Foo("foo", 1);

    // this is lazily created and cached by RuntimeSchema
    // so its safe to call RuntimeSchema.getSchema(Foo.class) over and over
    // The getSchema method is also thread-safe
    Schema<Foo> schema = RuntimeSchema.getSchema(Foo.class);

    // Re-use (manage) this buffer to avoid allocating on every serialization
    LinkedBuffer buffer = LinkedBuffer.allocate(512);

    // ser
    final byte[] protostuff;
    try
    {
        protostuff = ProtostuffIOUtil.toByteArray(foo, schema, buffer);
    }
    finally
    {
        buffer.clear();
    }

    // deser
    Foo fooParsed = schema.newMessage();
    ProtostuffIOUtil.mergeFrom(protostuff, fooParsed, schema);
}

Maven

  1. When you generate schemas for your classes
<dependency>
  <groupId>io.protostuff</groupId>
  <artifactId>protostuff-core</artifactId>
  <version>1.5.9</version>
</dependency>
  1. Runtime schemas
<dependency>
  <groupId>io.protostuff</groupId>
  <artifactId>protostuff-runtime</artifactId>
  <version>1.5.9</version>
</dependency>

Questions/Concerns/Suggestions

Requirements

Java 1.6 or higher

Build Requirements

Maven 3.2.3 or higher

Developing with eclipse

mvn install && mvn eclipse:eclipse
# Open eclipse, import existing project, navigate to the protostuff module you're after, then hit 'Finish'.