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 booleanprivate final TextFormat.Printer.FieldReporterLevelprivate final StringBuilderprivate final Appendableprivate final Descriptors.Descriptorprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTextGenerator(Appendable output, boolean singleLineMode, Descriptors.Descriptor rootMessageType, TextFormat.Printer.FieldReporterLevel fieldReporterLevel) -
Method Summary
Modifier and TypeMethodDescriptionvoideol()Signifies reaching the "end of the current line" in the output.voidindent()Indent text by two spaces.voidoutdent()Reduces the current indent level by two spaces, or crashes if the indent level is zero.voidprint(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
-