Awesome Open Source
Awesome Open Source


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


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

For more information, go to


  1. For the core formats (protostuff, protobuf, graph)
  1. For schemas generated at runtime


public final class Foo
    String name;
    int id;
    public Foo(String name, int id)
    { = name; = 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;
        protostuff = ProtostuffIOUtil.toByteArray(foo, schema, buffer);

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

Important (for version 1.8.x)

If you are to purely use this to replace java serialization (no compatibility with protobuf), set the following system properties:


You can also customize it programmatically:

static final DefaultIdStrategy STRATEGY = new DefaultIdStrategy(IdStrategy.DEFAULT_FLAGS 
        | IdStrategy.MORPH_MAP_INTERFACES
        | IdStrategy.MORPH_NON_FINAL_POJOS);

Use it:

Schema<Foo> schema = RuntimeSchema.getSchema(Foo.class, STRATEGY);



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'.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (412,761
Json (40,093
Graph (24,455
Protobuf (4,301
Compatibility (2,988
Protostuff (20