public final class TextFormat
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TextFormat.ParseException
Thrown when parsing an invalid text format message.
|
Modifier and Type | Method and Description |
---|---|
static void |
merge(java.lang.CharSequence input,
ExtensionRegistry extensionRegistry,
Message.Builder builder)
Parse a text-format message from
input and merge the contents
into builder . |
static void |
merge(java.lang.CharSequence input,
Message.Builder builder)
Parse a text-format message from
input and merge the contents
into builder . |
static void |
merge(java.lang.Readable input,
ExtensionRegistry extensionRegistry,
Message.Builder builder)
Parse a text-format message from
input and merge the contents
into builder . |
static void |
merge(java.lang.Readable input,
Message.Builder builder)
Parse a text-format message from
input and merge the contents
into builder . |
static void |
print(MessageOrBuilder message,
java.lang.Appendable output)
Outputs a textual representation of the Protocol Message supplied into
the parameter output.
|
static void |
print(UnknownFieldSet fields,
java.lang.Appendable output)
Outputs a textual representation of
fields to output . |
static void |
printField(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output) |
static java.lang.String |
printFieldToString(Descriptors.FieldDescriptor field,
java.lang.Object value) |
static void |
printFieldValue(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output)
Outputs a textual representation of the value of given field value.
|
static java.lang.String |
printToString(MessageOrBuilder message)
Like
print() , but writes directly to a String and
returns it. |
static java.lang.String |
printToString(UnknownFieldSet fields)
Like
print() , but writes directly to a String and
returns it. |
static java.lang.String |
printToUnicodeString(MessageOrBuilder message)
Same as
printToString() , except that non-ASCII characters
in string type fields are not escaped in backslash+octals. |
static java.lang.String |
printToUnicodeString(UnknownFieldSet fields)
Same as
printToString() , except that non-ASCII characters
in string type fields are not escaped in backslash+octals. |
static void |
printUnknownFieldValue(int tag,
java.lang.Object value,
java.lang.Appendable output)
Outputs a textual representation of the value of an unknown field.
|
static java.lang.String |
shortDebugString(MessageOrBuilder message)
Generates a human readable form of this message, useful for debugging and
other purposes, with no newline characters.
|
static java.lang.String |
shortDebugString(UnknownFieldSet fields)
Generates a human readable form of the unknown fields, useful for debugging
and other purposes, with no newline characters.
|
public static void print(MessageOrBuilder message, java.lang.Appendable output) throws java.io.IOException
java.io.IOException
public static void print(UnknownFieldSet fields, java.lang.Appendable output) throws java.io.IOException
fields
to output
.java.io.IOException
public static java.lang.String shortDebugString(MessageOrBuilder message)
public static java.lang.String shortDebugString(UnknownFieldSet fields)
public static java.lang.String printToString(MessageOrBuilder message)
print()
, but writes directly to a String
and
returns it.public static java.lang.String printToString(UnknownFieldSet fields)
print()
, but writes directly to a String
and
returns it.public static java.lang.String printToUnicodeString(MessageOrBuilder message)
printToString()
, except that non-ASCII characters
in string type fields are not escaped in backslash+octals.public static java.lang.String printToUnicodeString(UnknownFieldSet fields)
printToString()
, except that non-ASCII characters
in string type fields are not escaped in backslash+octals.public static void printField(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
java.io.IOException
public static java.lang.String printFieldToString(Descriptors.FieldDescriptor field, java.lang.Object value)
public static 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 static void printUnknownFieldValue(int tag, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
tag
- the field's tag numbervalue
- 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 static void merge(java.lang.Readable input, Message.Builder builder) throws java.io.IOException
input
and merge the contents
into builder
.java.io.IOException
public static void merge(java.lang.CharSequence input, Message.Builder builder) throws TextFormat.ParseException
input
and merge the contents
into builder
.TextFormat.ParseException
public static void merge(java.lang.Readable input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws java.io.IOException
input
and merge the contents
into builder
. Extensions will be recognized if they are
registered in extensionRegistry
.java.io.IOException
public static void merge(java.lang.CharSequence input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws TextFormat.ParseException
input
and merge the contents
into builder
. Extensions will be recognized if they are
registered in extensionRegistry
.TextFormat.ParseException