|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wink.json4j.JSON
public class JSON
Helper class that does generic parsing of a JSON stream and returns the appropriate JSON structure (JSONArray or JSONObject). Note that it is slightly more efficient to directly parse with the appropriate object than to use this class to do a generalized parse.
Field Summary | |
---|---|
static java.lang.Object |
NULL
A constant for representing null. |
Constructor Summary | |
---|---|
JSON()
|
Method Summary | |
---|---|
static JSONArtifact |
parse(java.io.InputStream is)
Parse an InputStream of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.io.InputStream is,
boolean order)
Parse a InputStream of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.io.InputStream is,
boolean order,
boolean strict)
Parse a InputStream of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.io.Reader reader)
Parse a Reader of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.io.Reader reader,
boolean order)
Parse a Reader of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.io.Reader reader,
boolean order,
boolean strict)
Parse a Reader of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.lang.String str)
Parse a string of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.lang.String str,
boolean order)
Parse a string of JSON text into a JSONArtifact. |
static JSONArtifact |
parse(java.lang.String str,
boolean order,
boolean strict)
Parse a string of JSON text into a JSONArtifact. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object NULL
Constructor Detail |
---|
public JSON()
Method Detail |
---|
public static JSONArtifact parse(java.io.Reader reader, boolean order) throws JSONException, java.lang.NullPointerException
reader
- The character reader to read the JSON data from.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.
Note: The provided reader is not closed on completion of read; that is left to the caller.
Note: This is the same as calling parse(reader, order, false);
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.io.Reader reader, boolean order, boolean strict) throws JSONException, java.lang.NullPointerException
reader
- The character reader to read the JSON data from.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.strict
- Boolean flag to indicate if the content should be parsed in strict mode or not, meaning comments and unquoted strings are not allowed.
Note: The provided reader is not closed on completion of read; that is left to the caller.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.io.Reader reader) throws JSONException, java.lang.NullPointerException
reader
- The character reader to read the JSON data from.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.io.InputStream is, boolean order) throws JSONException, java.lang.NullPointerException
is
- The input stream to read from. The content is assumed to be UTF-8 encoded and handled as such.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.io.InputStream is, boolean order, boolean strict) throws JSONException, java.lang.NullPointerException
is
- The input stream to read from. The content is assumed to be UTF-8 encoded and handled as such.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.strict
- Boolean flag to indicate if the content should be parsed in strict mode or not, meaning comments and unquoted strings are not allowed.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.io.InputStream is) throws JSONException, java.lang.NullPointerException
is
- The input stream to read from. The content is assumed to be UTF-8 encoded and handled as such.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if reader is nullpublic static JSONArtifact parse(java.lang.String str, boolean order) throws JSONException, java.lang.NullPointerException
str
- The String to read from.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if str is nullpublic static JSONArtifact parse(java.lang.String str, boolean order, boolean strict) throws JSONException, java.lang.NullPointerException
str
- The String to read from.order
- Boolean flag indicating if the order of the JSON data should be preserved. This parameter only has an effect if the stream is JSON Object { ... } formatted data.strict
- Boolean flag to indicate if the content should be parsed in strict mode or not, meaning comments and unquoted strings are not allowed.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if str is nullpublic static JSONArtifact parse(java.lang.String str) throws JSONException, java.lang.NullPointerException
str
- The String to read from.
JSONException
- Thrown on errors during parse.
java.lang.NullPointerException
- Thrown if str is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |