java - What is the best approach for serializing BigDecimal/BigInteger to ProtocolBuffers -
I am starting to migrate protocol buffers to custom serialization mechanisms. Particularly used as a regular type of data type is business graphical.
Is there a good way to sort it into a protocol buffer? BigDisk for our current serialization routine serialization Two plane uses string (), and newer buggy (string) for deserialization - I believe that there is a better way.
My guess is to define a BigDCAM:
Message BDecimal {required int32 scale = 1; Required BInteger int_val = 2; }
But I'm not sure how to define a Bigteger - perhaps using its Battery () method?
Yes you should define BigInteger as BigInteger.toByteArray ().
My guess is that BigDecimal will be:
Message BDecimal {required int32 scale = 1; Required BInteger int_val = 2; }
While BigInteger
message BInteger {required bytes value = 1; Can be defined as; }
The code to control BigInteger will be:
write BInteger (Bigtegger Val) {BInteger.Builder Builder = BInteger.newBuilder (); ByteString Bytes = ByteStringCopyfrum (Wal. Toteere ()); Builder.setValue (byte); Return Manufacturer Build (); } Bigtegger read (BInteger message) {biostastring bytes = message.jet value (); Return the new BigIntega (bytes to Batteryre). }
Comments
Post a Comment