|
EZ JSON by Nathanaël Cottin |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ezjson.JSONEncoder
public final class JSONEncoder
Default JSON encoder to serialize JSON objects
Field Summary | |
---|---|
static char |
SPACE
Indentation for a pretty encoding using a space character |
static char |
TABULATION
Indentation for a pretty encoding using a tabulation character |
Constructor Summary | |
---|---|
JSONEncoder()
|
Method Summary | |
---|---|
static void |
encode(JSONObject obj,
java.io.PrintWriter out)
Serializes a JSON object to a destination writer using the most compact format. |
static void |
encodePretty(JSONObject obj,
char spacer,
java.io.PrintWriter out)
Serializes a JSON object using a human-readble encoding (which includes a pretty indentation) with no initial indentation |
static void |
encodePretty(JSONObject obj,
int offset,
char spacer,
java.io.PrintWriter out)
Serializes a JSON object using a human-readble encoding (which includes a pretty indentation) with an initial indentation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char SPACE
public static final char TABULATION
Constructor Detail |
---|
public JSONEncoder()
Method Detail |
---|
public static void encode(JSONObject obj, java.io.PrintWriter out) throws java.io.IOException
obj
- The non-null source JSON object to serializeout
- The destination writer to receive the serialized form of the
provided JSON object
java.io.IOException
- The destination writer could not be writtenencodePretty(org.ezjson.JSONObject, char, java.io.PrintWriter)
public static void encodePretty(JSONObject obj, char spacer, java.io.PrintWriter out) throws java.io.IOException
obj
- The non-null source JSON object to serializespacer
- A space character used for indentation, among
SPACE
and TABULATION
out
- The destination writer to receive the serialized form of the
provided JSON object
java.io.IOException
- Writing to the destination writer failedpublic static void encodePretty(JSONObject obj, int offset, char spacer, java.io.PrintWriter out) throws java.io.IOException
obj
- offset
- The initial indentation expressed with a positive number
of space charactersspacer
- A space character used for indentation, among
SPACE
and TABULATION
out
- out The destination writer to receive the serialized form of the
provided JSON object
java.io.IOException
- Writing to the destination writer failed
|
EZ JSON by Nathanaël Cottin |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |