public static final class TextFormat.Printer
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
TextFormat.Printer |
escapingNonAscii(boolean escapeNonAscii)
Return a new Printer instance with the specified escape mode.
|
void |
print(MessageOrBuilder message,
java.lang.Appendable output)
Outputs a textual representation of the Protocol Message supplied into the parameter output.
|
void |
print(com.google.protobuf.UnknownFieldSet fields,
java.lang.Appendable output)
Outputs a textual representation of
fields to output . |
void |
printField(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output) |
java.lang.String |
printFieldToString(Descriptors.FieldDescriptor field,
java.lang.Object value) |
void |
printFieldValue(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output)
Outputs a textual representation of the value of given field value.
|
java.lang.String |
printToString(MessageOrBuilder message)
Like
print() , but writes directly to a String and returns it. |
java.lang.String |
printToString(com.google.protobuf.UnknownFieldSet fields)
Like
print() , but writes directly to a String and returns it. |
java.lang.String |
shortDebugString(Descriptors.FieldDescriptor field,
java.lang.Object value)
Generates a human readable form of the field, useful for debugging and other purposes, with
no newline characters.
|
java.lang.String |
shortDebugString(MessageOrBuilder message)
Generates a human readable form of this message, useful for debugging and other purposes,
with no newline characters.
|
java.lang.String |
shortDebugString(com.google.protobuf.UnknownFieldSet fields)
Generates a human readable form of the unknown fields, useful for debugging and other
purposes, with no newline characters.
|
TextFormat.Printer |
usingTypeRegistry(TypeRegistry typeRegistry)
Creates a new
TextFormat.Printer using the given typeRegistry. |
public TextFormat.Printer escapingNonAscii(boolean escapeNonAscii)
escapeNonAscii
- If true, the new Printer will escape non-ASCII characters (this is the
default behavior. If false, the new Printer will print non-ASCII characters as is. In
either case, the new Printer still escapes newlines and quotes in strings.TextFormat.Printer
,
with the escape mode set to the given parameter.public TextFormat.Printer usingTypeRegistry(TypeRegistry typeRegistry)
TextFormat.Printer
using the given typeRegistry. The new Printer clones all other
configurations from the current TextFormat.Printer
.java.lang.IllegalArgumentException
- if a registry is already set.public void print(MessageOrBuilder message, java.lang.Appendable output) throws java.io.IOException
java.io.IOException
public void print(com.google.protobuf.UnknownFieldSet fields, java.lang.Appendable output) throws java.io.IOException
fields
to output
.java.io.IOException
public java.lang.String printFieldToString(Descriptors.FieldDescriptor field, java.lang.Object value)
public void printField(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
java.io.IOException
public void printFieldValue(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
field
- the descriptor of the fieldvalue
- the value of the fieldoutput
- the output to which to append the formatted valuejava.lang.ClassCastException
- if the value is not appropriate for the given field descriptorjava.io.IOException
- if there is an exception writing to the outputpublic java.lang.String printToString(MessageOrBuilder message)
print()
, but writes directly to a String
and returns it.public java.lang.String printToString(com.google.protobuf.UnknownFieldSet fields)
print()
, but writes directly to a String
and returns it.public java.lang.String shortDebugString(MessageOrBuilder message)
public java.lang.String shortDebugString(Descriptors.FieldDescriptor field, java.lang.Object value)
public java.lang.String shortDebugString(com.google.protobuf.UnknownFieldSet fields)