public final class TextFormat extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TextFormat
Thrown when parsing an invalid text format message.
|
static class |
TextFormat
Parser for text-format proto2 instances.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeDoubleQuotesAndBackslashes(String
Escape double quotes and backslashes in a String for unicode output of a message.
|
static TextFormat |
getParser()
Return a
Parser instance which can parse text-format messages.
|
static void |
merge(CharSequence
Parse a text-format message from
input and merge the contents into
builder.
|
static void |
merge(CharSequence
Parse a text-format message from
input and merge the contents into
builder.
|
static void |
merge(Readable
Parse a text-format message from
input and merge the contents into
builder.
|
static void |
merge(Readable
Parse a text-format message from
input and merge the contents into
builder.
|
static void |
print(MessageOrBuilder
Outputs a textual representation of the Protocol Message supplied into the parameter output.
|
static void |
print(UnknownFieldSet
Outputs a textual representation of
fields to
output.
|
static void |
printField(Descriptors
|
static String |
printFieldToString(Descriptors
|
static void |
printFieldValue(Descriptors
Outputs a textual representation of the value of given field value.
|
static String |
printToString(MessageOrBuilder
Like
print(), but writes directly to a
String and returns it.
|
static String |
printToString(UnknownFieldSet
Like
print(), but writes directly to a
String and returns it.
|
static String |
printToUnicodeString(MessageOrBuilder
Same as
printToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.
|
static String |
printToUnicodeString(UnknownFieldSet
Same as
printToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.
|
static void |
printUnicode(MessageOrBuilder
Same as
print(), except that non-ASCII characters are not escaped.
|
static void |
printUnicode(UnknownFieldSet
Same as
print(), except that non-ASCII characters are not escaped.
|
static void |
printUnknownFieldValue(int tag, Object
Outputs a textual representation of the value of an unknown field.
|
static String |
shortDebugString(MessageOrBuilder
Generates a human readable form of this message, useful for debugging and other purposes, with no newline characters.
|
static String |
shortDebugString(UnknownFieldSet
Generates a human readable form of the unknown fields, useful for debugging and other purposes, with no newline characters.
|
static String |
unsignedToString(int value)
Convert an unsigned 32-bit integer to a string.
|
static String |
unsignedToString(long value)
Convert an unsigned 64-bit integer to a string.
|
public static void print(MessageOrBuildermessage, Appendable output) throws IOException
IOException
public static void print(UnknownFieldSetfields, Appendable output) throws IOException
fields to
output.
IOException
public static void printUnicode(MessageOrBuildermessage, Appendable output) throws IOException
print(), except that non-ASCII characters are not escaped.
IOException
public static void printUnicode(UnknownFieldSetfields, Appendable output) throws IOException
print(), except that non-ASCII characters are not escaped.
IOException
public static StringshortDebugString(MessageOrBuilder message)
public static StringshortDebugString(UnknownFieldSet fields)
public static StringprintToString(MessageOrBuilder message)
print(), but writes directly to a
String and returns it.
public static StringprintToString(UnknownFieldSet fields)
print(), but writes directly to a
String and returns it.
public static StringprintToUnicodeString(MessageOrBuilder message)
printToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.
public static StringprintToUnicodeString(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, Object value, Appendable output) throws IOException
IOException
public static StringprintFieldToString(Descriptors .FieldDescriptor field, Object value)
public static void printFieldValue(Descriptors.FieldDescriptor field, Object value, Appendable output) throws IOException
field - the descriptor of the field
value - the value of the field
output - the output to which to append the formatted value
ClassCastException - if the value is not appropriate for the given field descriptor
IOException - if there is an exception writing to the output
public static void printUnknownFieldValue(int tag,
Object value,
Appendable output)
throws IOException
tag - the field's tag number
value - the value of the field
output - the output to which to append the formatted value
ClassCastException - if the value is not appropriate for the given field descriptor
IOException - if there is an exception writing to the output
public static StringunsignedToString(int value)
public static StringunsignedToString(long value)
public static TextFormat.Parser getParser()
Parser instance which can parse text-format messages. The returned instance is thread-safe.
public static void merge(Readableinput, Message .Builder builder) throws IOException
input and merge the contents into
builder.
IOException
public static void merge(CharSequenceinput, Message .Builder builder) throws TextFormat .ParseException
input and merge the contents into
builder.
TextFormat.ParseException
public static void merge(Readableinput, ExtensionRegistry extensionRegistry, Message .Builder builder) throws IOException
input and merge the contents into
builder. Extensions will be recognized if they are registered in
extensionRegistry.
IOException
public static void merge(CharSequenceinput, 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