public class JsonJacksonFormat extends ProtobufFormatter
(c) 2011 Neustar, Inc. All Rights Reserved.
, wenboz@google.com Wenbo Zhu, kenton@google.com Kenton Varda
ProtobufFormatter.ParseException
Constructor and Description |
---|
JsonJacksonFormat() |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.core.JsonGenerator |
createGenerator(OutputStream output) |
void |
merge(InputStream input,
Charset cs,
com.google.protobuf.ExtensionRegistry extensionRegistry,
com.google.protobuf.Message.Builder builder)
Parse a text-format message from
input and merge the contents into builder . |
void |
merge(com.fasterxml.jackson.core.JsonParser parser,
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(com.fasterxml.jackson.core.JsonParser parser,
com.google.protobuf.ExtensionRegistry extensionRegistry,
com.google.protobuf.Message.Builder builder)
Parse a single field from
parser and merge it into builder . |
void |
print(com.google.protobuf.Message message,
com.fasterxml.jackson.core.JsonGenerator generator)
Outputs a Smile representation of the Protocol Message supplied into the parameter output.
|
void |
print(com.google.protobuf.Message message,
OutputStream output,
Charset cs)
Outputs a Smile representation of the Protocol Message supplied into the parameter output.
|
void |
print(com.google.protobuf.UnknownFieldSet fields,
OutputStream output,
Charset cs)
Outputs a Smile representation of
fields to output . |
void |
printField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value,
com.fasterxml.jackson.core.JsonGenerator generator) |
protected void |
printMessage(com.google.protobuf.Message message,
com.fasterxml.jackson.core.JsonGenerator generator) |
protected void |
printUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields,
com.fasterxml.jackson.core.JsonGenerator generator) |
getDefaultCharset, merge, merge, merge, print, print, printToString, printToString, setDefaultCharset
public void print(com.google.protobuf.Message message, OutputStream output, Charset cs) throws IOException
print
in class ProtobufFormatter
message
- the protobuf message to formatoutput
- the stream to write the formatted messagecs
- the character set to useIOException
public void print(com.google.protobuf.Message message, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOException
public void print(com.google.protobuf.UnknownFieldSet fields, OutputStream output, Charset cs) throws IOException
fields
to output
.print
in class ProtobufFormatter
fields
- unknown fields to formatoutput
- output the stream to write the formatted messagecs
- the character set to useIOException
public void merge(InputStream input, Charset cs, com.google.protobuf.ExtensionRegistry extensionRegistry, com.google.protobuf.Message.Builder builder) throws IOException
input
and merge the contents into builder
.
Extensions will be recognized if they are registered in extensionRegistry
.merge
in class ProtobufFormatter
IOException
public void merge(com.fasterxml.jackson.core.JsonParser parser, com.google.protobuf.ExtensionRegistry extensionRegistry, com.google.protobuf.Message.Builder builder) throws IOException
input
and merge the contents into builder
.
Extensions will be recognized if they are registered in extensionRegistry
.IOException
protected com.fasterxml.jackson.core.JsonGenerator createGenerator(OutputStream output) throws IOException
IOException
protected void printMessage(com.google.protobuf.Message message, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOException
public void printField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOException
protected void printUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOException
protected void mergeField(com.fasterxml.jackson.core.JsonParser parser, com.google.protobuf.ExtensionRegistry extensionRegistry, com.google.protobuf.Message.Builder builder) throws com.fasterxml.jackson.core.JsonParseException, IOException
parser
and merge it into builder
. If a ',' is
detected after the field ends, the next field will be parsed automaticallyIOException
com.fasterxml.jackson.core.JsonParseException
Copyright © 2017. All rights reserved.