protobuf-java-format
protobuf-java-format copied to clipboard
Provide serialization and de-serialization of different formats based on Google’s protobuf Message. Enables overriding the default (byte array) output to text based formats such as XML, JSON and HTML.
message A { //xxx } message B { optional A a=0; } B.Builder builder = B.newBuild(); new JsonFormat().merge("{a: null}", ExtensionRegistry.getEmptyRegistry(), builder); Will throw exception like Exception in thread "main" com.googlecode.protobuf.format.JsonFormat$ParseException:...
Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 2.5.0 to 3.16.1. Release notes Sourced from protobuf-java's releases. Protocol Buffers v3.16.1 Java Improve performance characteristics of UnknownFieldSet parsing (#9371) Protocol Buffers v3.16.0 C++ Fix compiler warnings...
Hi, I am trying to parse a sample document into a Protobuf Message, using the [AddressBook schema from Google examples](https://github.com/google/protobuf/blob/master/examples/addressbook.proto): Here is the document: ```xml John Doe 42 [email protected] Jane...
This method may produce invalid json with hex numbers. The convention on json: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf Numbers > A number is a sequence of decimal digits with no superfluous leading zero. It...
For any AbstractCharBasedFormatter, printToString can print directly to a String and not have to convert to bytes and back again. This avoids call to ByteArrayOutputStream.toString() at ProtobufFormatter:91 which uses JVM...
Tryin to deserialize a previous serialized message that contains Any types, returns an error. XmlFormater : com.googlecode.protobuf.format.ProtobufFormatter$ParseException: 1:83: Expected ">". JsonFormater: Protocol message contained an invalid tag (zero).
On Line: https://github.com/bivas/protobuf-java-format/blob/master/src/main/java/com/googlecode/protobuf/format/XmlFormat.java#L181 Should perform a Commons Text StringEscapeUtils.escapeXml() so it escapes Ampersands and such inside the text.
On line : https://github.com/bivas/protobuf-java-format/blob/master/src/main/java/com/googlecode/protobuf/format/HtmlFormat.java#L197 The HTML format when printing the String should do something like Commons Text StringEscapeUtils.escapeHtml4(text); to escape ampersands and such inside the text.
ProtobufFormatter.printToString method current does not consider the defaultCharset when convert the ByteArrayOutputStream to String
based on work by @mchataigner