Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.google.protobuf.TextFormat.Printer Class Reference

Public Member Functions

Printer escapingNonAscii (boolean escapeNonAscii)
 
void print (final MessageOrBuilder message, final Appendable output) throws IOException
 
void print (final UnknownFieldSet fields, final Appendable output) throws IOException
 
void printField (final FieldDescriptor field, final Object value, final Appendable output) throws IOException
 
String printFieldToString (final FieldDescriptor field, final Object value)
 
void printFieldValue (final FieldDescriptor field, final Object value, final Appendable output) throws IOException
 
String printToString (final MessageOrBuilder message)
 
String printToString (final UnknownFieldSet fields)
 
String shortDebugString (final FieldDescriptor field, final Object value)
 
String shortDebugString (final MessageOrBuilder message)
 
String shortDebugString (final UnknownFieldSet fields)
 

Private Member Functions

void print (final MessageOrBuilder message, final TextGenerator generator) throws IOException
 
 Printer (boolean escapeNonAscii)
 
void printField (final FieldDescriptor field, final Object value, final TextGenerator generator) throws IOException
 
void printFieldValue (final FieldDescriptor field, final Object value, final TextGenerator generator) throws IOException
 
void printMessage (final MessageOrBuilder message, final TextGenerator generator) throws IOException
 
void printSingleField (final FieldDescriptor field, final Object value, final TextGenerator generator) throws IOException
 

Static Private Member Functions

static void printUnknownField (final int number, final int wireType, final List<?> values, final TextGenerator generator) throws IOException
 
static void printUnknownFields (final UnknownFieldSet unknownFields, final TextGenerator generator) throws IOException
 
static void printUnknownFieldValue (final int tag, final Object value, final TextGenerator generator) throws IOException
 

Private Attributes

final boolean escapeNonAscii
 

Static Private Attributes

static final Printer DEFAULT = new Printer(true)
 

Detailed Description

Helper class for converting protobufs to text.

Definition at line 285 of file TextFormat.java.

Constructor & Destructor Documentation

◆ Printer()

com.google.protobuf.TextFormat.Printer.Printer ( boolean  escapeNonAscii)
inlineprivate

Definition at line 293 of file TextFormat.java.

Member Function Documentation

◆ escapingNonAscii()

Printer com.google.protobuf.TextFormat.Printer.escapingNonAscii ( boolean  escapeNonAscii)
inline

Return a new Printer instance with the specified escape mode.

Parameters
escapeNonAsciiIf true, the new Printer will escape non-ASCII characters (this is the default behavior. If false, the new Printer will print non-ASCII characters as is. In either case, the new Printer still escapes newlines and quotes in strings.
Returns
a new Printer that clones all other configurations from the current Printer, with the escape mode set to the given parameter.

Definition at line 306 of file TextFormat.java.

◆ print() [1/3]

void com.google.protobuf.TextFormat.Printer.print ( final MessageOrBuilder  message,
final Appendable  output 
) throws IOException
inline

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)

Definition at line 315 of file TextFormat.java.

◆ print() [2/3]

void com.google.protobuf.TextFormat.Printer.print ( final MessageOrBuilder  message,
final TextGenerator  generator 
) throws IOException
inlineprivate

Definition at line 324 of file TextFormat.java.

◆ print() [3/3]

void com.google.protobuf.TextFormat.Printer.print ( final UnknownFieldSet  fields,
final Appendable  output 
) throws IOException
inline

Outputs a textual representation of

to

.

Definition at line 320 of file TextFormat.java.

◆ printField() [1/2]

void com.google.protobuf.TextFormat.Printer.printField ( final FieldDescriptor  field,
final Object  value,
final Appendable  output 
) throws IOException
inline

Definition at line 339 of file TextFormat.java.

◆ printField() [2/2]

void com.google.protobuf.TextFormat.Printer.printField ( final FieldDescriptor  field,
final Object  value,
final TextGenerator  generator 
) throws IOException
inlineprivate

Definition at line 344 of file TextFormat.java.

◆ printFieldToString()

String com.google.protobuf.TextFormat.Printer.printFieldToString ( final FieldDescriptor  field,
final Object  value 
)
inline

Definition at line 329 of file TextFormat.java.

◆ printFieldValue() [1/2]

void com.google.protobuf.TextFormat.Printer.printFieldValue ( final FieldDescriptor  field,
final Object  value,
final Appendable  output 
) throws IOException
inline

Outputs a textual representation of the value of given field value.

Parameters
fieldthe descriptor of the field
valuethe value of the field
outputthe output to which to append the formatted value
Exceptions
ClassCastExceptionif the value is not appropriate for the given field descriptor
IOExceptionif there is an exception writing to the output

Definition at line 366 of file TextFormat.java.

◆ printFieldValue() [2/2]

void com.google.protobuf.TextFormat.Printer.printFieldValue ( final FieldDescriptor  field,
final Object  value,
final TextGenerator  generator 
) throws IOException
inlineprivate

Definition at line 372 of file TextFormat.java.

◆ printMessage()

void com.google.protobuf.TextFormat.Printer.printMessage ( final MessageOrBuilder  message,
final TextGenerator  generator 
) throws IOException
inlineprivate

Definition at line 540 of file TextFormat.java.

◆ printSingleField()

void com.google.protobuf.TextFormat.Printer.printSingleField ( final FieldDescriptor  field,
final Object  value,
final TextGenerator  generator 
) throws IOException
inlineprivate

Definition at line 548 of file TextFormat.java.

◆ printToString() [1/2]

String com.google.protobuf.TextFormat.Printer.printToString ( final MessageOrBuilder  message)
inline

Like

, but writes directly to a

String

and returns it.

Definition at line 441 of file TextFormat.java.

◆ printToString() [2/2]

String com.google.protobuf.TextFormat.Printer.printToString ( final UnknownFieldSet  fields)
inline

Like

, but writes directly to a

String

and returns it.

Definition at line 451 of file TextFormat.java.

◆ printUnknownField()

static void com.google.protobuf.TextFormat.Printer.printUnknownField ( final int  number,
final int  wireType,
final List<?>  values,
final TextGenerator  generator 
) throws IOException
inlinestaticprivate

Definition at line 616 of file TextFormat.java.

◆ printUnknownFields()

static void com.google.protobuf.TextFormat.Printer.printUnknownFields ( final UnknownFieldSet  unknownFields,
final TextGenerator  generator 
) throws IOException
inlinestaticprivate

Definition at line 590 of file TextFormat.java.

◆ printUnknownFieldValue()

static void com.google.protobuf.TextFormat.Printer.printUnknownFieldValue ( final int  tag,
final Object  value,
final TextGenerator  generator 
) throws IOException
inlinestaticprivate

Definition at line 503 of file TextFormat.java.

◆ shortDebugString() [1/3]

String com.google.protobuf.TextFormat.Printer.shortDebugString ( final FieldDescriptor  field,
final Object  value 
)
inline

Generates a human readable form of the field, useful for debugging and other purposes, with no newline characters.

Definition at line 479 of file TextFormat.java.

◆ shortDebugString() [2/3]

String com.google.protobuf.TextFormat.Printer.shortDebugString ( final MessageOrBuilder  message)
inline

Generates a human readable form of this message, useful for debugging and other purposes, with no newline characters.

Definition at line 465 of file TextFormat.java.

◆ shortDebugString() [3/3]

String com.google.protobuf.TextFormat.Printer.shortDebugString ( final UnknownFieldSet  fields)
inline

Generates a human readable form of the unknown fields, useful for debugging and other purposes, with no newline characters.

Definition at line 493 of file TextFormat.java.

Member Data Documentation

◆ DEFAULT

final Printer com.google.protobuf.TextFormat.Printer.DEFAULT = new Printer(true)
staticprivate

Definition at line 288 of file TextFormat.java.

◆ escapeNonAscii

final boolean com.google.protobuf.TextFormat.Printer.escapeNonAscii
private

Whether to escape non ASCII characters with backslash and octal.

Definition at line 291 of file TextFormat.java.


The documentation for this class was generated from the following file:
com.google.protobuf.TextFormat.Printer.print
void print(final MessageOrBuilder message, final Appendable output)
Definition: TextFormat.java:315
fields
static const upb_fielddef fields[107]
Definition: ruby/ext/google/protobuf_c/upb.c:7671
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:08