java - How to tell protostuff to pack property to fixed32 and not int32 -
i'm trying serialize following java object protobuf using protostuff:
public class headertest { private int version; private uuid messageid; public headertest() {} // required jackson public headertest(uuid messageid, int version) { this.messageid = messageid; this.version = version; } public int getversion() { return version; } public void setversion(int version) { this.version = version; } public uuid getmessageid() { return messageid; } public void setmessageid(uuid messageid) { this.messageid = messageid; } }
with following code:
schema<headertest> headertestschema = runtimeschema.getschema(headertest.class); byte[] headertestbuff = protostuffioutil.tobytearray(headertestinstance, headertestschema, linkedbuffer.allocate());
i fixed size buffer protostuff serialize version integer varint type ( amount of bytes use represent integer changes according integer size )
how can tell protostuff serialize specific property fixed32 fix amount of bytes
thanks
runtimeschema
not allow select fixed32
type integer field. can use int32
/int64
.
the thing can - can estimate maximum size of buffer. each int32
takes @ 5 bytes.
Comments
Post a Comment