Send feedback
Class TextFormat.Printer (3.19.4)
Stay organized with collections
Save and categorize content based on your preferences.
public static final class TextFormat . Printer
Helper class for converting protobufs to text.
Inheritance
Object >
TextFormat.Printer
Methods
escapingNonAscii(boolean escapeNonAscii)
public TextFormat . Printer escapingNonAscii ( boolean escapeNonAscii )
Return a new Printer instance with the specified escape mode.
Parameter
Name
Description
escapeNonAscii
boolean
If 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
Type
Description
TextFormat.Printer
a new Printer that clones all other configurations from the current Printer ,
with the escape mode set to the given parameter.
print(MessageOrBuilder message, Appendable output)
public void print ( MessageOrBuilder message , Appendable output )
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)
print(UnknownFieldSet fields, Appendable output)
public void print ( UnknownFieldSet fields , Appendable output )
Outputs a textual representation of fields
to output
.
printField(Descriptors.FieldDescriptor field, Object value, Appendable output)
public void printField ( Descriptors . FieldDescriptor field , Object value , Appendable output )
printFieldToString(Descriptors.FieldDescriptor field, Object value)
public String printFieldToString ( Descriptors . FieldDescriptor field , Object value )
Returns
Type
Description
String
printFieldValue(Descriptors.FieldDescriptor field, Object value, Appendable output)
public void printFieldValue ( Descriptors . FieldDescriptor field , Object value , Appendable output )
Outputs a textual representation of the value of given field value.
Exceptions
Type
Description
IOException
if the value is not appropriate for the given field descriptor
printToString(MessageOrBuilder message)
public String printToString ( MessageOrBuilder message )
Like print()
, but writes directly to a String
and returns it.
Returns
Type
Description
String
printToString(UnknownFieldSet fields)
public String printToString ( UnknownFieldSet fields )
Like print()
, but writes directly to a String
and returns it.
Returns
Type
Description
String
shortDebugString(Descriptors.FieldDescriptor field, Object value)
public String shortDebugString ( Descriptors . FieldDescriptor field , Object value )
Generates a human readable form of the field, useful for debugging and other purposes, with
no newline characters.
Returns
Type
Description
String
shortDebugString(MessageOrBuilder message)
public String shortDebugString ( MessageOrBuilder message )
Generates a human readable form of this message, useful for debugging and other purposes,
with no newline characters.
Returns
Type
Description
String
shortDebugString(UnknownFieldSet fields)
public String shortDebugString ( UnknownFieldSet fields )
Generates a human readable form of the unknown fields, useful for debugging and other
purposes, with no newline characters.
Returns
Type
Description
String
usingTypeRegistry(TypeRegistry typeRegistry)
public TextFormat . Printer usingTypeRegistry ( TypeRegistry typeRegistry )
Creates a new Printer using the given typeRegistry. The new Printer clones all other
configurations from the current Printer .
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-13 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-13 UTC."],[],[]]