Questions tagged [protostuff]

Protostuff is the stuff that leverages google's protobuf.

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

Protocol Buffers file parser and code generator.

web-site: http://www.protostuff.io/

source: https://github.com/protostuff/protostuff

43 questions
3
votes
1 answer

Why does protostuff corrupt objects when using generics combined with circular references?

I am using protostuff binary with circular references and generics. As a very simplistic scenario i have the following classes: public class A { private String name; private B b; public String getName() { return name; …
2
votes
0 answers

Can Protostuff support converting java objects(map types) into Protobuf bytes?

Protostuff has a ProtobufIOUtil that seems to be able to convert Java objects into protobuf bytes. Currently, it has been found that there may be differences when dealing with map types. For example: @Getter @Setter public class User { @Tag(1) …
Criwran
  • 317
  • 3
  • 16
2
votes
0 answers

Using Protostuff on Android causes RuntimeException because of missing sun.reflect.ReflectionFactory

I'm trying to use Protostuff version 1.7.2 in Android to serialize and deserialize some user-defined classes. I'm generating the Protostuff's schema's during runtime with the RuntimeSchema.getSchema() method. However, I'm running into a…
Daan
  • 147
  • 15
2
votes
0 answers

what is the most efficient way to serialize primitive type array by protostuff

There is no example of how to serialize primitive type array by protostuff. I also want to know which way is the most efficient. At first, I write code as follow: long[] array = {1L, 2L, 3L}; Schema schema =…
yuhongye
  • 21
  • 3
2
votes
1 answer

Converting object (inclusive lambda) to JSON and vice versa

I'm using protostuff to convert object of my own class to JSON and vice versa. There is java 8 and lambdas. Convert to JSON file like: LinkedBuffer buffer = LinkedBuffer.allocate(2048); Schema schema =…
I.G.
  • 35
  • 5
2
votes
1 answer

Type of object in byte[] to deserialize with schema?

I'm trying to replace my string based protocol with one that uses protobuf. I serialize move command with: Schema schema = RuntimeSchema.getSchema(MoveCommand.class); ProtostuffIOUtil.toByteArray(this, schema, buffer) And my hit…
Tinus Tate
  • 2,237
  • 2
  • 12
  • 33
2
votes
1 answer

Replace the class of a field at runtime (for protostuff)

I'm working on a framework for backwards compatiblity between different versions of a class (from serialized binary representations). One thing I'm stuck on is how to replace a field used in a class with a different version of the field's class - at…
user2323596
  • 523
  • 1
  • 6
  • 11
2
votes
0 answers

Protostuff throws Protocol message contained an invalid tag (zero)

I am trying to serialize a POJO using the example of their wiki but I am getting "Protocol message contained an invalid tag (zero)." I want my POJO to be converted to byte[], send it to a message broker, retrieve it and deserialize it. I have a unit…
hveiga
  • 6,725
  • 7
  • 54
  • 78
2
votes
1 answer

How to get protobuf-net and protostuff to mutually support inherited classes in .Net and Java?

I'm doing communications between a .Net-based program on a Windows system and Android devices. On the .Net end I'm using Marc Gravell's great protobuf-net program, and on the Android end I'm using David Yu's great protostuff program. My procedure…
RenniePet
  • 11,420
  • 7
  • 80
  • 106
2
votes
1 answer

Compatibility between Protobuf and Protostuff

are Classes generated by the Protostuff code generator compatible with those created by Protobuf? I tried to (de)serialize some simple messages and got several exceptions: Proto-File (WrapperClass.proto) package tutorial; option java_package =…
Laures
  • 5,389
  • 11
  • 50
  • 76
1
vote
0 answers

Attempting to make an algorithm that translates to different numerical bases

I'd like to make an algorithm, f, that takes a, x and y, and returns b in base y as opposed to a in base x. I can't seem to make sense of how to do this, and I've made multiple attempts. How does one go about that? def f(a, x, y): pass # should…
1
vote
1 answer

How to add field into class with deserialization compatibility using Protostuff?

I have an immutable object of class class A { public A(B b) { this.a = b.c; } @Tag(1) final int a; } How to add field into class with backward binary deserialization compatibility using Protostuff without writing custom…
Ibes
  • 21
  • 2
1
vote
1 answer

RuntimeSchema in Protostuff cyclic references?

We're using Protostuff's RuntimeSchema to serialize our data. This mostly works but we sometimes get: java.lang.StackOverflowError at io.protostuff.runtime.ObjectSchema.mergeFrom(ObjectSchema.java:350) ~[protostuff-runtime-1.5.3.jar:1.5.3] at…
sternr
  • 6,216
  • 9
  • 39
  • 63
1
vote
1 answer

How to tell protostuff to pack property to fixed32 and not int32

I'm trying to serialize the following Java object to protobuf using protostuff: public class HeaderTest { private int version; private UUID messageId; public HeaderTest() {} // required by jackson public HeaderTest(UUID messageId, int…
Eldad
  • 107
  • 1
  • 2
  • 9
1
vote
1 answer

Is adding fields at the end of a java class always safe when using Protostuff default RuntimeSchema?

I use Protostuff RuntimeSchema in the most basic way : Schema schema = RuntimeSchema.createFrom(Bean.class); I will save the result byte[] somewhere and deserialize it in the future. But there is a chance that I will add some fields in…
Mobility
  • 3,117
  • 18
  • 31
1
2 3