Package com.google.protobuf
Class TextFormat.TextGenerator
java.lang.Object
com.google.protobuf.TextFormat.TextGenerator
- Enclosing class:
TextFormat
An inner class for writing text to the output stream.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final TextFormat.Printer.FieldReporterLevel
private final StringBuilder
private final Appendable
private final Descriptors.Descriptor
private final boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TextGenerator
(Appendable output, boolean singleLineMode, Descriptors.Descriptor rootMessageType, TextFormat.Printer.FieldReporterLevel fieldReporterLevel) -
Method Summary
Modifier and TypeMethodDescriptionvoid
eol()
Signifies reaching the "end of the current line" in the output.void
indent()
Indent text by two spaces.void
outdent()
Reduces the current indent level by two spaces, or crashes if the indent level is zero.void
print
(CharSequence text) Print text to the output stream.
-
Field Details
-
output
-
indent
-
singleLineMode
private final boolean singleLineMode -
atStartOfLine
private boolean atStartOfLine -
fieldReporterLevel
-
rootMessageType
-
-
Constructor Details
-
TextGenerator
private TextGenerator(Appendable output, boolean singleLineMode, Descriptors.Descriptor rootMessageType, TextFormat.Printer.FieldReporterLevel fieldReporterLevel)
-
-
Method Details
-
indent
public void indent()Indent text by two spaces. After calling Indent(), two spaces will be inserted at the beginning of each line of text. Indent() may be called multiple times to produce deeper indents. -
outdent
public void outdent()Reduces the current indent level by two spaces, or crashes if the indent level is zero. -
print
Print text to the output stream. Bare newlines are never expected to be passed to this method; to indicate the end of a line, call "eol()".- Throws:
IOException
-
eol
Signifies reaching the "end of the current line" in the output. In single-line mode, this does not result in a newline being emitted, but ensures that a separating space is written before the next output.- Throws:
IOException
-