public class JsonFormat extends AbstractCharBasedFormatter
(c) 2009-10 Orbitz World Wide. All Rights Reserved.
Based on the original code by:, wenboz@google.com Wenbo Zhu, kenton@google.com Kenton Varda
| Modifier and Type | Class and Description |
|---|---|
protected static class |
JsonFormat.JsonGenerator
An inner class for writing text to the output stream.
|
static class |
JsonFormat.ParseException
Thrown when parsing an invalid text format message.
|
protected static class |
JsonFormat.Tokenizer
Represents a stream of tokens parsed from a
String. |
| Constructor and Description |
|---|
JsonFormat() |
| Modifier and Type | Method and Description |
|---|---|
void |
merge(CharSequence input,
com.google.protobuf.ExtensionRegistry extensionRegistry,
com.google.protobuf.Message.Builder builder)
Parse a text-format message from
input and merge the contents into builder. |
protected void |
mergeField(JsonFormat.Tokenizer tokenizer,
com.google.protobuf.ExtensionRegistry extensionRegistry,
com.google.protobuf.Message.Builder builder)
Parse a single field from
tokenizer and merge it into builder. |
void |
print(com.google.protobuf.Message message,
Appendable output)
Outputs a textual representation of the Protocol Message supplied into the parameter output.
|
protected void |
print(com.google.protobuf.Message message,
JsonFormat.JsonGenerator generator) |
void |
print(com.google.protobuf.UnknownFieldSet fields,
Appendable output)
Outputs a textual representation of
fields to output. |
void |
printField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value,
JsonFormat.JsonGenerator generator) |
protected void |
printUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields,
JsonFormat.JsonGenerator generator) |
merge, merge, print, printgetDefaultCharset, merge, merge, merge, print, print, printToString, printToString, setDefaultCharsetpublic void print(com.google.protobuf.Message message,
Appendable output)
throws IOException
print in class AbstractCharBasedFormatterIOExceptionpublic void print(com.google.protobuf.UnknownFieldSet fields,
Appendable output)
throws IOException
fields to output.print in class AbstractCharBasedFormatterIOExceptionprotected void print(com.google.protobuf.Message message,
JsonFormat.JsonGenerator generator)
throws IOException
IOExceptionpublic void printField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value,
JsonFormat.JsonGenerator generator)
throws IOException
IOExceptionprotected void printUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields,
JsonFormat.JsonGenerator generator)
throws IOException
IOExceptionpublic void merge(CharSequence input, com.google.protobuf.ExtensionRegistry extensionRegistry, com.google.protobuf.Message.Builder builder) throws JsonFormat.ParseException
input and merge the contents into builder.
Extensions will be recognized if they are registered in extensionRegistry.merge in class AbstractCharBasedFormatterJsonFormat.ParseExceptionprotected void mergeField(JsonFormat.Tokenizer tokenizer, com.google.protobuf.ExtensionRegistry extensionRegistry, com.google.protobuf.Message.Builder builder) throws JsonFormat.ParseException
tokenizer and merge it into builder. If a ',' is
detected after the field ends, the next field will be parsed automaticallyJsonFormat.ParseExceptionCopyright © 2016. All rights reserved.