Class TextFormat.TextGenerator

java.lang.Object
com.google.protobuf.TextFormat.TextGenerator
Enclosing class:
TextFormat

private static final class TextFormat.TextGenerator extends Object
An inner class for writing text to the output stream.
  • Field Details

    • output

      private final Appendable output
    • indent

      private final StringBuilder indent
    • singleLineMode

      private final boolean singleLineMode
    • atStartOfLine

      private boolean atStartOfLine
  • Constructor Details

    • TextGenerator

      private TextGenerator(Appendable output, boolean singleLineMode)
  • 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

      public void print(CharSequence text) throws 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:
      IOException
    • eol

      public void eol() throws 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:
      IOException