Package com.google.protobuf.util
Class JsonFormat.PrettyTextGenerator
- java.lang.Object
-
- com.google.protobuf.util.JsonFormat.PrettyTextGenerator
-
- All Implemented Interfaces:
JsonFormat.TextGenerator
- Enclosing class:
- JsonFormat
private static final class JsonFormat.PrettyTextGenerator extends java.lang.Object implements JsonFormat.TextGenerator
A TextGenerator adds indentation when writing formatted text.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanatStartOfLineprivate java.lang.StringBuilderindentprivate java.lang.Appendableoutput
-
Constructor Summary
Constructors Modifier Constructor Description privatePrettyTextGenerator(java.lang.Appendable output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidindent()Indent text by two spaces.voidoutdent()Reduces the current indent level by two spaces, or crashes if the indent level is zero.voidprint(java.lang.CharSequence text)Print text to the output stream.private voidwrite(java.lang.CharSequence data)
-
-
-
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.- Specified by:
indentin interfaceJsonFormat.TextGenerator
-
outdent
public void outdent()
Reduces the current indent level by two spaces, or crashes if the indent level is zero.- Specified by:
outdentin interfaceJsonFormat.TextGenerator
-
print
public void print(java.lang.CharSequence text) throws java.io.IOExceptionPrint text to the output stream.- Specified by:
printin interfaceJsonFormat.TextGenerator- Throws:
java.io.IOException
-
write
private void write(java.lang.CharSequence data) throws java.io.IOException- Throws:
java.io.IOException
-
-