Package com.dslplatform.json
Class PrettifyOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.dslplatform.json.PrettifyOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public final class PrettifyOutputStream extends java.io.OutputStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPrettifyOutputStream.IndentType
-
Field Summary
Fields Modifier and Type Field Description private booleanbeginObjectOrListprivate intcurrentIndentprivate static intINDENT_CACHE_SIZEprivate intindentLengthprivate PrettifyOutputStream.IndentTypeindentTypeprivate booleaninEscapeprivate booleaninStringprivate java.io.OutputStreamoutprivate static boolean[]WHITESPACE
-
Constructor Summary
Constructors Constructor Description PrettifyOutputStream(java.io.OutputStream out)PrettifyOutputStream(java.io.OutputStream out, PrettifyOutputStream.IndentType indentType, int indentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwrite(byte[] bytes, int off, int len)voidwrite(int b)private voidwriteNewLineWithIndent()
-
-
-
Field Detail
-
INDENT_CACHE_SIZE
private static final int INDENT_CACHE_SIZE
- See Also:
- Constant Field Values
-
WHITESPACE
private static final boolean[] WHITESPACE
-
out
private final java.io.OutputStream out
-
indentType
private final PrettifyOutputStream.IndentType indentType
-
indentLength
private final int indentLength
-
currentIndent
private int currentIndent
-
inString
private boolean inString
-
inEscape
private boolean inEscape
-
beginObjectOrList
private boolean beginObjectOrList
-
-
Constructor Detail
-
PrettifyOutputStream
public PrettifyOutputStream(java.io.OutputStream out)
-
PrettifyOutputStream
public PrettifyOutputStream(java.io.OutputStream out, PrettifyOutputStream.IndentType indentType, int indentLength)
-
-
Method Detail
-
write
public final void write(byte[] bytes, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public final void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
writeNewLineWithIndent
private void writeNewLineWithIndent() throws java.io.IOException- Throws:
java.io.IOException
-
-