Package com.google.protobuf.util
Class JsonFormat.Parser
- java.lang.Object
-
- com.google.protobuf.util.JsonFormat.Parser
-
- Enclosing class:
- JsonFormat
public static class JsonFormat.Parser extends java.lang.ObjectA Parser parses the proto3 JSON format into a protobuf message.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonFormat.ParserignoringUnknownFields()Creates a newJsonFormat.Parserconfigured to not throw an exception when an unknown field is encountered.voidmerge(java.io.Reader json, Message.Builder builder)Parses from the proto3 JSON encoding into a protobuf message.voidmerge(java.lang.String json, Message.Builder builder)Parses from the proto3 JSON format into a protobuf message.JsonFormat.ParserusingTypeRegistry(TypeRegistry registry)Creates a newJsonFormat.Parserusing the given registry.JsonFormat.ParserusingTypeRegistry(JsonFormat.TypeRegistry oldRegistry)Creates a newJsonFormat.Parserusing the given registry.
-
-
-
Method Detail
-
usingTypeRegistry
public JsonFormat.Parser usingTypeRegistry(JsonFormat.TypeRegistry oldRegistry)
Creates a newJsonFormat.Parserusing the given registry. The new Parser clones all other configurations from this Parser.- Throws:
java.lang.IllegalArgumentException- if a registry is already set
-
usingTypeRegistry
public JsonFormat.Parser usingTypeRegistry(TypeRegistry registry)
Creates a newJsonFormat.Parserusing the given registry. The new Parser clones all other configurations from this Parser.- Throws:
java.lang.IllegalArgumentException- if a registry is already set
-
ignoringUnknownFields
public JsonFormat.Parser ignoringUnknownFields()
Creates a newJsonFormat.Parserconfigured to not throw an exception when an unknown field is encountered. The new Parser clones all other configurations from this Parser.
-
merge
public void merge(java.lang.String json, Message.Builder builder) throws com.google.protobuf.InvalidProtocolBufferExceptionParses from the proto3 JSON format into a protobuf message.- Throws:
com.google.protobuf.InvalidProtocolBufferException- if the input is not valid JSON proto3 format or there are unknown fields in the input.
-
merge
public void merge(java.io.Reader json, Message.Builder builder) throws java.io.IOExceptionParses from the proto3 JSON encoding into a protobuf message.- Throws:
com.google.protobuf.InvalidProtocolBufferException- if the input is not valid proto3 JSON format or there are unknown fields in the inputjava.io.IOException- if reading from the input throws
-
-