org.opengts.util
Class JSON

java.lang.Object
  extended by org.opengts.util.JSON

public class JSON
extends java.lang.Object


Nested Class Summary
static class JSON._Array
          JSON Array
static class JSON._KeyValue
          JSON Key/Value pair
static class JSON._Object
          JSON Object class
static class JSON._Value
          JSON Value
static class JSON.JSONParsingContext
          JSON Parsing Context
static class JSON.JSONParsingException
          JSON Parse Exception
 
Constructor Summary
JSON()
          Constructor
JSON(java.io.InputStream input)
          Constructor
JSON(JSON._Object obj)
          Constructor
JSON(java.lang.String json)
          Constructor
 
Method Summary
 void debugDisplayObject()
          Print object contents (debug purposes only)
static java.lang.String escapeJSON(java.lang.String s)
          Converts the specified String to a JSON escaped value String.
 JSON._Object getObject()
          Gets the main JSON._Object
 boolean hasObject()
          Returns true if an object is defined
static void main(java.lang.String[] argv)
          Main test entry point
static JSON._Array parse_Array(java.lang.String v)
          Parse a JSON Array from the specified String
static JSON._Array parse_Array(java.lang.String v, JSON.JSONParsingContext context)
          Parse JSON Array from the specified String
static java.lang.String parse_Comment(java.lang.String v, JSON.JSONParsingContext context)
          Parse a JSON Comment from the specified String, starting at the specified location
static JSON._KeyValue parse_KeyValue(java.lang.String v, JSON.JSONParsingContext context)
          Parse a Key/Value pair from the specified String at the specified location
static java.lang.Number parse_Number(java.lang.String v, JSON.JSONParsingContext context)
          Parse a JSON Number
static JSON._Object parse_Object(java.lang.String v)
          Parse a JSON Object from the specified String.
static JSON._Object parse_Object(java.lang.String v, JSON.JSONParsingContext context)
          Parse a JSON Object from the specified String, starting at the specified location.
static java.lang.String parse_String(java.lang.String v, JSON.JSONParsingContext context)
          Parse a JSON String
static JSON._Value parse_Value(java.lang.String v)
          Parse a JSON Array from the specified String
static JSON._Value parse_Value(java.lang.String v, JSON.JSONParsingContext context)
          Parse JSON Value
 void setObject(JSON._Object obj)
          Sets the main JSON._Object
 java.lang.String toString()
          Return a String representation of this instance
 java.lang.String toString(boolean inclPrefix)
          Return a String representation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSON

public JSON()
Constructor


JSON

public JSON(JSON._Object obj)
Constructor


JSON

public JSON(java.lang.String json)
     throws JSON.JSONParsingException
Constructor

Throws:
JSON.JSONParsingException

JSON

public JSON(java.io.InputStream input)
     throws JSON.JSONParsingException,
            java.io.IOException
Constructor

Throws:
JSON.JSONParsingException
java.io.IOException
Method Detail

escapeJSON

public static java.lang.String escapeJSON(java.lang.String s)
Converts the specified String to a JSON escaped value String.

Parameters:
s - The String to convert to a JSON encoded String
Returns:
The JSON encoded String

parse_Comment

public static java.lang.String parse_Comment(java.lang.String v,
                                             JSON.JSONParsingContext context)
                                      throws JSON.JSONParsingException
Parse a JSON Comment from the specified String, starting at the specified location

Throws:
JSON.JSONParsingException

parse_Object

public static JSON._Object parse_Object(java.lang.String v)
                                 throws JSON.JSONParsingException
Parse a JSON Object from the specified String. Does not return null.

Throws:
JSON.JSONParsingException

parse_Object

public static JSON._Object parse_Object(java.lang.String v,
                                        JSON.JSONParsingContext context)
                                 throws JSON.JSONParsingException
Parse a JSON Object from the specified String, starting at the specified location. Does not return null.

Throws:
JSON.JSONParsingException

parse_KeyValue

public static JSON._KeyValue parse_KeyValue(java.lang.String v,
                                            JSON.JSONParsingContext context)
                                     throws JSON.JSONParsingException
Parse a Key/Value pair from the specified String at the specified location

Throws:
JSON.JSONParsingException

parse_Value

public static JSON._Value parse_Value(java.lang.String v)
                               throws JSON.JSONParsingException
Parse a JSON Array from the specified String

Throws:
JSON.JSONParsingException

parse_Value

public static JSON._Value parse_Value(java.lang.String v,
                                      JSON.JSONParsingContext context)
                               throws JSON.JSONParsingException
Parse JSON Value

Throws:
JSON.JSONParsingException

parse_Array

public static JSON._Array parse_Array(java.lang.String v)
                               throws JSON.JSONParsingException
Parse a JSON Array from the specified String

Throws:
JSON.JSONParsingException

parse_Array

public static JSON._Array parse_Array(java.lang.String v,
                                      JSON.JSONParsingContext context)
                               throws JSON.JSONParsingException
Parse JSON Array from the specified String

Throws:
JSON.JSONParsingException

parse_String

public static java.lang.String parse_String(java.lang.String v,
                                            JSON.JSONParsingContext context)
                                     throws JSON.JSONParsingException
Parse a JSON String

Throws:
JSON.JSONParsingException

parse_Number

public static java.lang.Number parse_Number(java.lang.String v,
                                            JSON.JSONParsingContext context)
                                     throws JSON.JSONParsingException
Parse a JSON Number

Throws:
JSON.JSONParsingException

hasObject

public boolean hasObject()
Returns true if an object is defined


getObject

public JSON._Object getObject()
Gets the main JSON._Object


setObject

public void setObject(JSON._Object obj)
Sets the main JSON._Object


toString

public java.lang.String toString()
Return a String representation of this instance

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean inclPrefix)
Return a String representation of this instance


debugDisplayObject

public void debugDisplayObject()
Print object contents (debug purposes only)


main

public static void main(java.lang.String[] argv)
Main test entry point