public abstract class JSONCollection extends java.lang.Object implements java.io.Serializable
JSONArray
and JSONObject
that exists to organize the code
for printing such objects (either compact or pretty).Constructor and Description |
---|
JSONCollection() |
Modifier and Type | Method and Description |
---|---|
void |
prettyPrint(java.io.PrintWriter writer)
Prints the JSONObject to the writer using indentation (two spaces per indentation level).
|
void |
print(java.io.PrintWriter writer)
Prints the JSONObject to the writer compactly (with no extra whitespace).
|
void |
print(java.io.PrintWriter writer,
boolean compact)
Prints the JSONObject to the write (compactly or not).
|
java.lang.String |
toCompactString()
Prints the JSONObject as a compact string (not extra punctuation).
|
java.lang.String |
toString()
Converts this JSON collection into a parsable string representation.
|
java.lang.String |
toString(boolean compact)
Converts the JSONObject to a compact or pretty-print string representation
|
public JSONCollection()
public java.lang.String toString()
toString
in class java.lang.Object
{
(left brace) and ending with }
(right
brace).public java.lang.String toString(boolean compact)
compact
- if true, return minimal format string.public java.lang.String toCompactString()
toString()
.public void print(java.io.PrintWriter writer, boolean compact)
writer
- to write content tocompact
- if true, then write compactly, if false, write with pretty printingpublic void print(java.io.PrintWriter writer)
public void prettyPrint(java.io.PrintWriter writer)
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.