Package akka.protobuf
Class TextFormat
- java.lang.Object
-
- akka.protobuf.TextFormat
-
public final class TextFormat extends java.lang.ObjectProvide text parsing and formatting support for proto2 instances. The implementation largely follows google/protobuf/text_format.cc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextFormat.ParseExceptionThrown when parsing an invalid text format message.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmerge(java.lang.CharSequence input, ExtensionRegistry extensionRegistry, Message.Builder builder)Parse a text-format message frominputand merge the contents intobuilder.static voidmerge(java.lang.CharSequence input, Message.Builder builder)Parse a text-format message frominputand merge the contents intobuilder.static voidmerge(java.lang.Readable input, ExtensionRegistry extensionRegistry, Message.Builder builder)Parse a text-format message frominputand merge the contents intobuilder.static voidmerge(java.lang.Readable input, Message.Builder builder)Parse a text-format message frominputand merge the contents intobuilder.static voidprint(MessageOrBuilder message, java.lang.Appendable output)Outputs a textual representation of the Protocol Message supplied into the parameter output.static voidprint(UnknownFieldSet fields, java.lang.Appendable output)Outputs a textual representation offieldstooutput.static voidprintField(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output)static java.lang.StringprintFieldToString(Descriptors.FieldDescriptor field, java.lang.Object value)static voidprintFieldValue(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.StringprintToString(MessageOrBuilder message)Likeprint(), but writes directly to aStringand returns it.static java.lang.StringprintToString(UnknownFieldSet fields)Likeprint(), but writes directly to aStringand returns it.static java.lang.StringprintToUnicodeString(MessageOrBuilder message)Same asprintToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.static java.lang.StringprintToUnicodeString(UnknownFieldSet fields)Same asprintToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.static voidprintUnknownFieldValue(int tag, java.lang.Object value, java.lang.Appendable output)Outputs a textual representation of the value of an unknown field.static java.lang.StringshortDebugString(MessageOrBuilder message)Generates a human readable form of this message, useful for debugging and other purposes, with no newline characters.static java.lang.StringshortDebugString(UnknownFieldSet fields)Generates a human readable form of the unknown fields, useful for debugging and other purposes, with no newline characters.
-
-
-
Method Detail
-
print
public static void print(MessageOrBuilder message, java.lang.Appendable output) throws java.io.IOException
Outputs a textual representation of the Protocol Message supplied into the parameter output. (This representation is the new version of the classic "ProtocolPrinter" output from the original Protocol Buffer system)- Throws:
java.io.IOException
-
print
public static void print(UnknownFieldSet fields, java.lang.Appendable output) throws java.io.IOException
Outputs a textual representation offieldstooutput.- Throws:
java.io.IOException
-
shortDebugString
public 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.
-
shortDebugString
public 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.
-
printToString
public static java.lang.String printToString(MessageOrBuilder message)
Likeprint(), but writes directly to aStringand returns it.
-
printToString
public static java.lang.String printToString(UnknownFieldSet fields)
Likeprint(), but writes directly to aStringand returns it.
-
printToUnicodeString
public static java.lang.String printToUnicodeString(MessageOrBuilder message)
Same asprintToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.
-
printToUnicodeString
public static java.lang.String printToUnicodeString(UnknownFieldSet fields)
Same asprintToString(), except that non-ASCII characters in string type fields are not escaped in backslash+octals.
-
printField
public static void printField(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
- Throws:
java.io.IOException
-
printFieldToString
public static java.lang.String printFieldToString(Descriptors.FieldDescriptor field, java.lang.Object value)
-
printFieldValue
public static void printFieldValue(Descriptors.FieldDescriptor field, java.lang.Object value, java.lang.Appendable output) throws java.io.IOException
Outputs a textual representation of the value of given field value.- Parameters:
field- the descriptor of the fieldvalue- the value of the fieldoutput- the output to which to append the formatted value- Throws:
java.lang.ClassCastException- if the value is not appropriate for the given field descriptorjava.io.IOException- if there is an exception writing to the output
-
printUnknownFieldValue
public static void printUnknownFieldValue(int tag, java.lang.Object value, java.lang.Appendable output) throws java.io.IOExceptionOutputs a textual representation of the value of an unknown field.- Parameters:
tag- the field's tag numbervalue- the value of the fieldoutput- the output to which to append the formatted value- Throws:
java.lang.ClassCastException- if the value is not appropriate for the given field descriptorjava.io.IOException- if there is an exception writing to the output
-
merge
public static void merge(java.lang.Readable input, Message.Builder builder) throws java.io.IOExceptionParse a text-format message frominputand merge the contents intobuilder.- Throws:
java.io.IOException
-
merge
public static void merge(java.lang.CharSequence input, Message.Builder builder) throws TextFormat.ParseExceptionParse a text-format message frominputand merge the contents intobuilder.- Throws:
TextFormat.ParseException
-
merge
public static void merge(java.lang.Readable input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws java.io.IOExceptionParse a text-format message frominputand merge the contents intobuilder. Extensions will be recognized if they are registered inextensionRegistry.- Throws:
java.io.IOException
-
merge
public static void merge(java.lang.CharSequence input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws TextFormat.ParseExceptionParse a text-format message frominputand merge the contents intobuilder. Extensions will be recognized if they are registered inextensionRegistry.- Throws:
TextFormat.ParseException
-
-