public final class TextFormat
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TextFormat.InvalidEscapeSequenceException
Thrown by
unescapeBytes(java.lang.CharSequence) and unescapeText(java.lang.String) when an invalid
escape sequence is seen. |
static class |
TextFormat.ParseException
Thrown when parsing an invalid text format message.
|
static class |
TextFormat.Parser
Parser for text-format proto2 instances.
|
static class |
TextFormat.Printer
Helper class for converting protobufs to text.
|
static class |
TextFormat.UnknownFieldParseException
Thrown when encountering an unknown field while parsing a text format message.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
escapeBytes(byte[] input)
Like
escapeBytes(ByteString), but used for byte array. |
static java.lang.String |
escapeBytes(ByteString input)
Escapes bytes in the format used in protocol buffer text format, which is the same as the
format used for C string literals.
|
static java.lang.String |
escapeDoubleQuotesAndBackslashes(java.lang.String input)
Escape double quotes and backslashes in a String for emittingUnicode output of a message.
|
static TextFormat.Parser |
getParser()
Return a
Parser instance which can parse text-format messages. |
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 <T extends Message> |
parse(java.lang.CharSequence input,
java.lang.Class<T> protoClass)
Parse a text-format message from
input. |
static <T extends Message> |
parse(java.lang.CharSequence input,
ExtensionRegistry extensionRegistry,
java.lang.Class<T> protoClass)
Parse a text-format message from
input. |
static void |
print(MessageOrBuilder message,
java.lang.Appendable output)
Deprecated.
Use
printer().print(MessageOrBuilder, Appendable) |
static void |
print(com.google.protobuf.UnknownFieldSet fields,
java.lang.Appendable output)
Deprecated.
Use
printer().print(UnknownFieldSet, Appendable) |
static TextFormat.Printer |
printer()
Printer instance which escapes non-ASCII characters.
|
static void |
printField(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output)
Deprecated.
Use
printer().printField(FieldDescriptor, Object, Appendable) |
static java.lang.String |
printFieldToString(Descriptors.FieldDescriptor field,
java.lang.Object value)
Deprecated.
Use
printer().printFieldToString(FieldDescriptor, Object) |
static void |
printFieldValue(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output)
Deprecated.
Use
printer().printFieldValue(FieldDescriptor, Object, Appendable) |
static java.lang.String |
printToString(MessageOrBuilder message)
Deprecated.
Use
message.toString() |
static java.lang.String |
printToString(com.google.protobuf.UnknownFieldSet fields)
Deprecated.
Use
UnknownFieldSet.toString() |
static java.lang.String |
printToUnicodeString(MessageOrBuilder message)
Deprecated.
Use
printer().escapingNonAscii(false).printToString(MessageOrBuilder) |
static java.lang.String |
printToUnicodeString(com.google.protobuf.UnknownFieldSet fields)
Deprecated.
Use
printer().escapingNonAscii(false).printToString(UnknownFieldSet) |
static void |
printUnicode(MessageOrBuilder message,
java.lang.Appendable output)
Deprecated.
Use
printer().escapingNonAscii(false).print(MessageOrBuilder, Appendable) |
static void |
printUnicode(com.google.protobuf.UnknownFieldSet fields,
java.lang.Appendable output)
Deprecated.
Use
printer().escapingNonAscii(false).print(UnknownFieldSet, Appendable) |
static void |
printUnicodeFieldValue(Descriptors.FieldDescriptor field,
java.lang.Object value,
java.lang.Appendable output)
Deprecated.
Use
printer().escapingNonAscii(false).printFieldValue(FieldDescriptor,
Object, Appendable) |
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(Descriptors.FieldDescriptor field,
java.lang.Object value)
Deprecated.
Use
printer().shortDebugString(FieldDescriptor, Object) |
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(com.google.protobuf.UnknownFieldSet fields)
Deprecated.
Use
printer().shortDebugString(UnknownFieldSet) |
static ByteString |
unescapeBytes(java.lang.CharSequence charString)
Un-escape a byte sequence as escaped using
escapeBytes(ByteString). |
static java.lang.String |
unsignedToString(int value)
Convert an unsigned 32-bit integer to a string.
|
static java.lang.String |
unsignedToString(long value)
Convert an unsigned 64-bit integer to a string.
|
@Deprecated public static void print(MessageOrBuilder message, java.lang.Appendable output) throws java.io.IOException
printer().print(MessageOrBuilder, Appendable)java.io.IOException@Deprecated
public static void print(com.google.protobuf.UnknownFieldSet fields,
java.lang.Appendable output)
throws java.io.IOException
printer().print(UnknownFieldSet, Appendable)fields to output.java.io.IOException@Deprecated public static void printUnicode(MessageOrBuilder message, java.lang.Appendable output) throws java.io.IOException
printer().escapingNonAscii(false).print(MessageOrBuilder, Appendable)print(), except that non-ASCII characters are not escaped.java.io.IOException@Deprecated
public static void printUnicode(com.google.protobuf.UnknownFieldSet fields,
java.lang.Appendable output)
throws java.io.IOException
printer().escapingNonAscii(false).print(UnknownFieldSet, Appendable)print(), except that non-ASCII characters are not escaped.java.io.IOExceptionpublic static java.lang.String shortDebugString(MessageOrBuilder message)
TextFormat.Printer.shortDebugString(MessageOrBuilder).@Deprecated public static java.lang.String shortDebugString(Descriptors.FieldDescriptor field, java.lang.Object value)
printer().shortDebugString(FieldDescriptor, Object)@Deprecated public static java.lang.String shortDebugString(com.google.protobuf.UnknownFieldSet fields)
printer().shortDebugString(UnknownFieldSet)@Deprecated public static java.lang.String printToString(MessageOrBuilder message)