com.google.protobuf
Class TextFormat

java.lang.Object
  extended by com.google.protobuf.TextFormat

public final class TextFormat
extends java.lang.Object

Provide ascii text parsing and formatting support for proto2 instances. The implementation largely follows google/protobuf/text_format.cc.

Author:
[email protected] Wenbo Zhu, [email protected] Kenton Varda

Nested Class Summary
static class TextFormat.ParseException
          Thrown when parsing an invalid text format message.
 
Constructor Summary
TextFormat()
           
 
Method Summary
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(Message 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, com.google.protobuf.TextFormat.TextGenerator generator)
           
static java.lang.String printToString(Message 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFormat

public TextFormat()
Method Detail

print

public static void print(Message 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 of fields to output.

Throws:
java.io.IOException

printToString

public static java.lang.String printToString(Message message)
Like print(), but writes directly to a String and returns it.


printToString

public static java.lang.String printToString(UnknownFieldSet fields)
Like print(), but writes directly to a String and returns it.


printField

public static void printField(Descriptors.FieldDescriptor field,
                              java.lang.Object value,
                              com.google.protobuf.TextFormat.TextGenerator generator)
                       throws java.io.IOException
Throws:
java.io.IOException

merge

public static void merge(java.lang.Readable input,
                         Message.Builder builder)
                  throws TextFormat.ParseException,
                         java.io.IOException
Parse a text-format message from input and merge the contents into builder.

Throws:
TextFormat.ParseException
java.io.IOException

merge

public static void merge(java.lang.CharSequence input,
                         Message.Builder builder)
                  throws TextFormat.ParseException
Parse a text-format message from input and merge the contents into builder.

Throws:
TextFormat.ParseException

merge

public static void merge(java.lang.Readable input,
                         ExtensionRegistry extensionRegistry,
                         Message.Builder builder)
                  throws TextFormat.ParseException,
                         java.io.IOException
Parse a text-format message from input and merge the contents into builder. Extensions will be recognized if they are registered in extensionRegistry.

Throws:
TextFormat.ParseException
java.io.IOException

merge

public static void merge(java.lang.CharSequence input,
                         ExtensionRegistry extensionRegistry,
                         Message.Builder builder)
                  throws TextFormat.ParseException
Parse a text-format message from input and merge the contents into builder. Extensions will be recognized if they are registered in extensionRegistry.

Throws:
TextFormat.ParseException


Copyright © 2008-2009. All Rights Reserved.