public abstract class JSONFormatterBase<T extends java.io.PrintStream> extends java.lang.Object implements JSONFormatter
Modifier and Type | Class and Description |
---|---|
static class |
JSONFormatterBase.IgnoringNullIterator
used when ignoring null entries in JSON objects
|
Modifier and Type | Field and Description |
---|---|
protected JSONFormatterConfiguration |
cfg |
protected static java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
ENTRY_COMPARATOR |
Modifier | Constructor and Description |
---|---|
protected |
JSONFormatterBase(JSONFormatterConfiguration cfg) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
append(T pout,
JSONArray o) |
protected abstract void |
append(T pout,
JSONObject o) |
protected void |
appendAny(T pout,
java.lang.Object anyJsonValue) |
protected void |
appendNewLine(T pout) |
protected void |
appendPrimitiveValue(T pout,
java.lang.Object primitiveValue) |
protected void |
appendUnicodeCharacter(T pout,
char c) |
protected void |
appendUnicodeString(T pout,
java.lang.String str) |
protected boolean |
exceedsEncodingRange(char c) |
java.lang.String |
format(JSONArray jsonArray) |
java.lang.String |
format(JSONCompoundType json) |
java.lang.String |
format(JSONObject jsonObject) |
java.lang.String |
format(java.lang.Object jsonValue) |
void |
format(java.io.OutputStream out,
JSONArray jsonArray) |
void |
format(java.io.OutputStream out,
JSONCompoundType json) |
void |
format(java.io.OutputStream out,
JSONObject jsonObject) |
void |
format(java.io.OutputStream out,
java.lang.Object jsonValue) |
JSONFormatterConfiguration |
getConfiguration() |
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
iterator(java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet)
creates an iterator, which respects formatter configuration
in respect to sorting of entries and ignoring of null values.
|
protected abstract T |
setupPrintStream(java.io.OutputStream out,
boolean autoflush,
java.lang.String charset)
called to setup a new PrintStream instance.
|
protected static final java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Object>> ENTRY_COMPARATOR
protected final JSONFormatterConfiguration cfg
protected JSONFormatterBase(JSONFormatterConfiguration cfg) throws JSONException
JSONException
public JSONFormatterConfiguration getConfiguration()
getConfiguration
in interface JSONFormatter
public java.lang.String format(JSONObject jsonObject) throws JSONException
format
in interface JSONFormatter
JSONException
public java.lang.String format(JSONArray jsonArray) throws JSONException
format
in interface JSONFormatter
JSONException
public java.lang.String format(java.lang.Object jsonValue) throws JSONException
format
in interface JSONFormatter
JSONException
public java.lang.String format(JSONCompoundType json) throws JSONException
format
in interface JSONFormatter
JSONException
public void format(java.io.OutputStream out, JSONCompoundType json) throws JSONException
format
in interface JSONFormatter
JSONException
public void format(java.io.OutputStream out, JSONObject jsonObject) throws JSONException
format
in interface JSONFormatter
JSONException
public void format(java.io.OutputStream out, JSONArray jsonArray) throws JSONException
format
in interface JSONFormatter
JSONException
public void format(java.io.OutputStream out, java.lang.Object jsonValue) throws JSONException
format
in interface JSONFormatter
JSONException
protected abstract T setupPrintStream(java.io.OutputStream out, boolean autoflush, java.lang.String charset) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
protected abstract void append(T pout, JSONArray o) throws JSONException
JSONException
protected abstract void append(T pout, JSONObject o) throws JSONException
JSONException
protected void appendPrimitiveValue(T pout, java.lang.Object primitiveValue)
protected void appendAny(T pout, java.lang.Object anyJsonValue) throws JSONException
JSONException
protected void appendNewLine(T pout)
protected void appendUnicodeString(T pout, java.lang.String str) throws JSONException
JSONException
protected void appendUnicodeCharacter(T pout, char c) throws JSONException
JSONException
protected boolean exceedsEncodingRange(char c)
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> iterator(java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet)