Package com.google.protobuf
Class TextFormat.TextGenerator
- java.lang.Object
-
- com.google.protobuf.TextFormat.TextGenerator
-
- Enclosing class:
- TextFormat
private static final class TextFormat.TextGenerator extends java.lang.Object
An inner class for writing text to the output stream.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
atStartOfLine
private TextFormat.Printer.FieldReporterLevel
fieldReporterLevel
private java.lang.StringBuilder
indent
private java.lang.Appendable
output
private boolean
singleLineMode
-
Constructor Summary
Constructors Modifier Constructor Description private
TextGenerator(java.lang.Appendable output, boolean singleLineMode, TextFormat.Printer.FieldReporterLevel fieldReporterLevel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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(java.lang.CharSequence text)
Print text to the output stream.
-
-
-
Field Detail
-
output
private final java.lang.Appendable output
-
indent
private final java.lang.StringBuilder indent
-
singleLineMode
private final boolean singleLineMode
-
atStartOfLine
private boolean atStartOfLine
-
fieldReporterLevel
private final TextFormat.Printer.FieldReporterLevel fieldReporterLevel
-
-
Constructor Detail
-
TextGenerator
private TextGenerator(java.lang.Appendable output, boolean singleLineMode, TextFormat.Printer.FieldReporterLevel fieldReporterLevel)
-
-
Method Detail
-
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
public void print(java.lang.CharSequence text) throws java.io.IOException
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:
java.io.IOException
-
eol
public void eol() throws java.io.IOException
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:
java.io.IOException
-
-