******************************************************************************/\r
package org.json;\r
\r
+/*\r
+Copyright (c) 2002 JSON.org\r
\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * This provides static methods to convert comma delimited text into a\r
+ * JSONArray, and to covert a JSONArray into comma delimited text. Comma\r
+ * delimited text is a very popular format for data interchange. It is\r
+ * understood by most database, spreadsheet, and organizer programs.\r
+ * <p>\r
+ * Each row of text represents a row in a table or a data record. Each row\r
+ * ends with a NEWLINE character. Each row contains one or more values.\r
+ * Values are separated by commas. A value can contain any character except\r
+ * for comma, unless is is wrapped in single quotes or double quotes.\r
+ * <p>\r
+ * The first row usually contains the names of the columns.\r
+ * <p>\r
+ * A comma delimited list can be converted into a JSONArray of JSONObjects.\r
+ * The names for the elements in the JSONObjects can be taken from the names\r
+ * in the first row.\r
+ * @author JSON.org\r
+ * @version 2012-11-13\r
+ */\r
public class CDL {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
+/*\r
+Copyright (c) 2002 JSON.org\r
\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * Convert a web browser cookie specification to a JSONObject and back.\r
+ * JSON and Cookies are both notations for name/value pairs.\r
+ * @author JSON.org\r
+ * @version 2010-12-24\r
+ */\r
public class Cookie {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
-import java.util.Iterator;\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+import java.util.Iterator;\r
\r
+/**\r
+ * Convert a web browser cookie list string to a JSONObject and back.\r
+ * @author JSON.org\r
+ * @version 2010-12-24\r
+ */\r
public class CookieList {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
import java.util.Iterator;\r
\r
-\r
+/**\r
+ * Convert an HTTP header to a JSONObject and back.\r
+ * @author JSON.org\r
+ * @version 2010-12-24\r
+ */\r
public class HTTP {\r
\r
/** Carriage return/line feed. */\r
******************************************************************************/\r
package org.json;\r
\r
+/*\r
+Copyright (c) 2002 JSON.org\r
\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * The HTTPTokener extends the JSONTokener to provide additional methods\r
+ * for the parsing of HTTP headers.\r
+ * @author JSON.org\r
+ * @version 2012-11-13\r
+ */\r
public class HTTPTokener extends JSONTokener {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
+/*\r
+ Copyright (c) 2002 JSON.org\r
+\r
+ Permission is hereby granted, free of charge, to any person obtaining a copy\r
+ of this software and associated documentation files (the "Software"), to deal\r
+ in the Software without restriction, including without limitation the rights\r
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+ copies of the Software, and to permit persons to whom the Software is\r
+ furnished to do so, subject to the following conditions:\r
+\r
+ The above copyright notice and this permission notice shall be included in all\r
+ copies or substantial portions of the Software.\r
+\r
+ The Software shall be used for Good, not Evil.\r
+\r
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ SOFTWARE.\r
+ */\r
\r
import java.io.IOException;\r
import java.io.StringWriter;\r
import java.util.List;\r
import java.util.Map;\r
\r
-\r
+/**\r
+ * A JSONArray is an ordered sequence of values. Its external text form is a\r
+ * string wrapped in square brackets with commas separating the values. The\r
+ * internal form is an object having <code>get</code> and <code>opt</code>\r
+ * methods for accessing the values by index, and <code>put</code> methods for\r
+ * adding or replacing values. The values can be any of these types:\r
+ * <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,\r
+ * <code>Number</code>, <code>String</code>, or the\r
+ * <code>JSONObject.NULL object</code>.\r
+ * <p>\r
+ * The constructor can convert a JSON text into a Java object. The\r
+ * <code>toString</code> method converts to JSON text.\r
+ * <p>\r
+ * A <code>get</code> method returns a value if one can be found, and throws an\r
+ * exception if one cannot be found. An <code>opt</code> method returns a\r
+ * default value instead of throwing an exception, and so is useful for\r
+ * obtaining optional values.\r
+ * <p>\r
+ * The generic <code>get()</code> and <code>opt()</code> methods return an\r
+ * object which you can cast or query for type. There are also typed\r
+ * <code>get</code> and <code>opt</code> methods that do type checking and type\r
+ * coercion for you.\r
+ * <p>\r
+ * The texts produced by the <code>toString</code> methods strictly conform to\r
+ * JSON syntax rules. The constructors are more forgiving in the texts they will\r
+ * accept:\r
+ * <ul>\r
+ * <li>An extra <code>,</code> <small>(comma)</small> may appear just\r
+ * before the closing bracket.</li>\r
+ * <li>The <code>null</code> value will be inserted when there is <code>,</code>\r
+ * <small>(comma)</small> elision.</li>\r
+ * <li>Strings may be quoted with <code>'</code> <small>(single\r
+ * quote)</small>.</li>\r
+ * <li>Strings do not need to be quoted at all if they do not begin with a quote\r
+ * or single quote, and if they do not contain leading or trailing spaces, and\r
+ * if they do not contain any of these characters:\r
+ * <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers and\r
+ * if they are not the reserved words <code>true</code>, <code>false</code>, or\r
+ * <code>null</code>.</li>\r
+ * <li>Values can be separated by <code>;</code> <small>(semicolon)</small> as\r
+ * well as by <code>,</code> <small>(comma)</small>.</li>\r
+ * </ul>\r
+ *\r
+ * @author JSON.org\r
+ * @version 2012-11-13\r
+ */\r
public class JSONArray {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/**\r
+ * The JSONException is thrown by the JSON.org classes when things are amiss.\r
+ *\r
+ * @author JSON.org\r
+ * @version 2013-02-10\r
+ */\r
public class JSONException extends RuntimeException {\r
private static final long serialVersionUID = 0;\r
private Throwable cause;\r
\r
- \r
+ /**\r
+ * Constructs a JSONException with an explanatory message.\r
+ *\r
+ * @param message\r
+ * Detail about the reason for the exception.\r
+ */\r
public JSONException(String message) {\r
super(message);\r
}\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/*\r
+Copyright (c) 2008 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
import java.util.Iterator;\r
\r
+\r
+/**\r
+ * This provides static methods to convert an XML text into a JSONArray or\r
+ * JSONObject, and to covert a JSONArray or JSONObject into an XML text using\r
+ * the JsonML transform.\r
+ *\r
+ * @author JSON.org\r
+ * @version 2012-03-28\r
+ */\r
public class JSONML {\r
\r
/**\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
import java.io.IOException;\r
import java.io.StringWriter;\r
import java.util.ResourceBundle;\r
import java.util.Set;\r
\r
-\r
+/**\r
+ * A JSONObject is an unordered collection of name/value pairs. Its external\r
+ * form is a string wrapped in curly braces with colons between the names and\r
+ * values, and commas between the values and names. The internal form is an\r
+ * object having <code>get</code> and <code>opt</code> methods for accessing the\r
+ * values by name, and <code>put</code> methods for adding or replacing values\r
+ * by name. The values can be any of these types: <code>Boolean</code>,\r
+ * <code>JSONArray</code>, <code>JSONObject</code>, <code>Number</code>,\r
+ * <code>String</code>, or the <code>JSONObject.NULL</code> object. A JSONObject\r
+ * constructor can be used to convert an external form JSON text into an\r
+ * internal form whose values can be retrieved with the <code>get</code> and\r
+ * <code>opt</code> methods, or to convert values into a JSON text using the\r
+ * <code>put</code> and <code>toString</code> methods. A <code>get</code> method\r
+ * returns a value if one can be found, and throws an exception if one cannot be\r
+ * found. An <code>opt</code> method returns a default value instead of throwing\r
+ * an exception, and so is useful for obtaining optional values.\r
+ * <p>\r
+ * The generic <code>get()</code> and <code>opt()</code> methods return an\r
+ * object, which you can cast or query for type. There are also typed\r
+ * <code>get</code> and <code>opt</code> methods that do type checking and type\r
+ * coercion for you. The opt methods differ from the get methods in that they do\r
+ * not throw. Instead, they return a specified value, such as null.\r
+ * <p>\r
+ * The <code>put</code> methods add or replace values in an object. For example,\r
+ *\r
+ * <pre>\r
+ * myString = new JSONObject().put("JSON", "Hello, World!").toString();\r
+ * </pre>\r
+ *\r
+ * produces the string <code>{"JSON": "Hello, World"}</code>.\r
+ * <p>\r
+ * The texts produced by the <code>toString</code> methods strictly conform to\r
+ * the JSON syntax rules. The constructors are more forgiving in the texts they\r
+ * will accept:\r
+ * <ul>\r
+ * <li>An extra <code>,</code> <small>(comma)</small> may appear just\r
+ * before the closing brace.</li>\r
+ * <li>Strings may be quoted with <code>'</code> <small>(single\r
+ * quote)</small>.</li>\r
+ * <li>Strings do not need to be quoted at all if they do not begin with a quote\r
+ * or single quote, and if they do not contain leading or trailing spaces, and\r
+ * if they do not contain any of these characters:\r
+ * <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers and\r
+ * if they are not the reserved words <code>true</code>, <code>false</code>, or\r
+ * <code>null</code>.</li>\r
+ * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as by\r
+ * <code>:</code>.</li>\r
+ * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as\r
+ * well as by <code>,</code> <small>(comma)</small>.</li>\r
+ * </ul>\r
+ *\r
+ * @author JSON.org\r
+ * @version 2012-12-01\r
+ */\r
public class JSONObject {\r
/**\r
* The maximum number of keys in the key pool.\r
* *\r
******************************************************************************/\r
package org.json;\r
-\r
+/**\r
+ * The <code>JSONString</code> interface allows a <code>toJSONString()</code>\r
+ * method so that a class can change the behavior of\r
+ * <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>,\r
+ * and <code>JSONWriter.value(</code>Object<code>)</code>. The\r
+ * <code>toJSONString</code> method will be used instead of the default behavior\r
+ * of using the Object's <code>toString()</code> method and quoting the result.\r
+ */\r
public interface JSONString {\r
-\r
+ /**\r
+ * The <code>toJSONString</code> method allows a class to produce its own JSON\r
+ * serialization.\r
+ *\r
+ * @return A strictly syntactically correct JSON text.\r
+ */\r
public String toJSONString();\r
}\r
******************************************************************************/\r
package org.json;\r
\r
+/*\r
+Copyright (c) 2006 JSON.org\r
\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
\r
-import java.io.StringWriter;\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
+import java.io.StringWriter;\r
\r
+/**\r
+ * JSONStringer provides a quick and convenient way of producing JSON text.\r
+ * The texts produced strictly conform to JSON syntax rules. No whitespace is\r
+ * added, so the results are ready for transmission or storage. Each instance of\r
+ * JSONStringer can produce one JSON text.\r
+ * <p>\r
+ * A JSONStringer instance provides a <code>value</code> method for appending\r
+ * values to the\r
+ * text, and a <code>key</code>\r
+ * method for adding keys before values in objects. There are <code>array</code>\r
+ * and <code>endArray</code> methods that make and bound array values, and\r
+ * <code>object</code> and <code>endObject</code> methods which make and bound\r
+ * object values. All of these methods return the JSONWriter instance,\r
+ * permitting cascade style. For example, <pre>\r
+ * myString = new JSONStringer()\r
+ * .object()\r
+ * .key("JSON")\r
+ * .value("Hello, World!")\r
+ * .endObject()\r
+ * .toString();</pre> which produces the string <pre>\r
+ * {"JSON":"Hello, World!"}</pre>\r
+ * <p>\r
+ * The first method called must be <code>array</code> or <code>object</code>.\r
+ * There are no methods for adding commas or colons. JSONStringer adds them for\r
+ * you. Objects and arrays can be nested up to 20 levels deep.\r
+ * <p>\r
+ * This can sometimes be easier than using a JSONObject to build a string.\r
+ * @author JSON.org\r
+ * @version 2008-09-18\r
+ */\r
public class JSONStringer extends JSONWriter {\r
/**\r
* Make a fresh JSONStringer. It can be used to build one JSON text.\r
super(new StringWriter());\r
}\r
\r
- \r
+ /**\r
+ * Return the JSON text. This method is used to obtain the product of the\r
+ * JSONStringer instance. It will return <code>null</code> if there was a\r
+ * problem in the construction of the JSON text (such as the calls to\r
+ * <code>array</code> were not properly balanced with calls to\r
+ * <code>endArray</code>).\r
+ * @return The JSON text.\r
+ */\r
public String toString() {\r
return this.mode == 'd' ? this.writer.toString() : null;\r
}\r
import java.io.Reader;\r
import java.io.StringReader;\r
\r
-\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * A JSONTokener takes a source string and extracts characters and tokens from\r
+ * it. It is used by the JSONObject and JSONArray constructors to parse\r
+ * JSON source strings.\r
+ * @author JSON.org\r
+ * @version 2012-02-16\r
+ */\r
public class JSONTokener {\r
\r
private long character;\r
import java.io.IOException;\r
import java.io.Writer;\r
\r
+/*\r
+Copyright (c) 2006 JSON.org\r
\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * JSONWriter provides a quick and convenient way of producing JSON text.\r
+ * The texts produced strictly conform to JSON syntax rules. No whitespace is\r
+ * added, so the results are ready for transmission or storage. Each instance of\r
+ * JSONWriter can produce one JSON text.\r
+ * <p>\r
+ * A JSONWriter instance provides a <code>value</code> method for appending\r
+ * values to the\r
+ * text, and a <code>key</code>\r
+ * method for adding keys before values in objects. There are <code>array</code>\r
+ * and <code>endArray</code> methods that make and bound array values, and\r
+ * <code>object</code> and <code>endObject</code> methods which make and bound\r
+ * object values. All of these methods return the JSONWriter instance,\r
+ * permitting a cascade style. For example, <pre>\r
+ * new JSONWriter(myWriter)\r
+ * .object()\r
+ * .key("JSON")\r
+ * .value("Hello, World!")\r
+ * .endObject();</pre> which writes <pre>\r
+ * {"JSON":"Hello, World!"}</pre>\r
+ * <p>\r
+ * The first method called must be <code>array</code> or <code>object</code>.\r
+ * There are no methods for adding commas or colons. JSONWriter adds them for\r
+ * you. Objects and arrays can be nested up to 20 levels deep.\r
+ * <p>\r
+ * This can sometimes be easier than using a JSONObject to build a string.\r
+ * @author JSON.org\r
+ * @version 2011-11-24\r
+ */\r
public class JSONWriter {\r
private static final int maxdepth = 200;\r
\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
import java.io.IOException;\r
import java.io.StringWriter;\r
import java.util.ResourceBundle;\r
import java.util.Set;\r
\r
-\r
+/**\r
+ * A JSONObject is an unordered collection of name/value pairs. Its external\r
+ * form is a string wrapped in curly braces with colons between the names and\r
+ * values, and commas between the values and names. The internal form is an\r
+ * object having <code>get</code> and <code>opt</code> methods for accessing the\r
+ * values by name, and <code>put</code> methods for adding or replacing values\r
+ * by name. The values can be any of these types: <code>Boolean</code>,\r
+ * <code>JSONArray</code>, <code>JSONObject</code>, <code>Number</code>,\r
+ * <code>String</code>, or the <code>JSONObject.NULL</code> object. A JSONObject\r
+ * constructor can be used to convert an external form JSON text into an\r
+ * internal form whose values can be retrieved with the <code>get</code> and\r
+ * <code>opt</code> methods, or to convert values into a JSON text using the\r
+ * <code>put</code> and <code>toString</code> methods. A <code>get</code> method\r
+ * returns a value if one can be found, and throws an exception if one cannot be\r
+ * found. An <code>opt</code> method returns a default value instead of throwing\r
+ * an exception, and so is useful for obtaining optional values.\r
+ * <p>\r
+ * The generic <code>get()</code> and <code>opt()</code> methods return an\r
+ * object, which you can cast or query for type. There are also typed\r
+ * <code>get</code> and <code>opt</code> methods that do type checking and type\r
+ * coercion for you. The opt methods differ from the get methods in that they do\r
+ * not throw. Instead, they return a specified value, such as null.\r
+ * <p>\r
+ * The <code>put</code> methods add or replace values in an object. For example,\r
+ *\r
+ * <pre>\r
+ * myString = new JSONObject().put("JSON", "Hello, World!").toString();\r
+ * </pre>\r
+ *\r
+ * produces the string <code>{"JSON": "Hello, World"}</code>.\r
+ * <p>\r
+ * The texts produced by the <code>toString</code> methods strictly conform to\r
+ * the JSON syntax rules. The constructors are more forgiving in the texts they\r
+ * will accept:\r
+ * <ul>\r
+ * <li>An extra <code>,</code> <small>(comma)</small> may appear just\r
+ * before the closing brace.</li>\r
+ * <li>Strings may be quoted with <code>'</code> <small>(single\r
+ * quote)</small>.</li>\r
+ * <li>Strings do not need to be quoted at all if they do not begin with a quote\r
+ * or single quote, and if they do not contain leading or trailing spaces, and\r
+ * if they do not contain any of these characters:\r
+ * <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers and\r
+ * if they are not the reserved words <code>true</code>, <code>false</code>, or\r
+ * <code>null</code>.</li>\r
+ * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as by\r
+ * <code>:</code>.</li>\r
+ * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as\r
+ * well as by <code>,</code> <small>(comma)</small>.</li>\r
+ * </ul>\r
+ *\r
+ * @author JSON.org\r
+ * @version 2012-12-01\r
+ */\r
public class LOGJSONObject {\r
/**\r
* The maximum number of keys in the key pool.\r
******************************************************************************/\r
package org.json;\r
\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
\r
import java.util.Iterator;\r
\r
\r
+/**\r
+ * This provides static methods to convert an XML text into a JSONObject,\r
+ * and to covert a JSONObject into an XML text.\r
+ * @author JSON.org\r
+ * @version 2012-10-26\r
+ */\r
public class XML {\r
\r
/** The Character '&'. */\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
-\r
-\r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
+\r
+/**\r
+ * The XMLTokener extends the JSONTokener to provide additional methods\r
+ * for the parsing of XML texts.\r
+ * @author JSON.org\r
+ * @version 2012-11-13\r
+ */\r
public class XMLTokener extends JSONTokener {\r
\r
\r
# * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
# *\r
#-------------------------------------------------------------------------------\r
+<!-- CVS: $Id: package.html,v 1.1 2013/04/26 21:01:51 eby Exp $ -->\r
+<!--\r
+ AT&T - PROPRIETARY\r
+ THIS FILE CONTAINS PROPRIETARY INFORMATION OF\r
+ AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN\r
+ ACCORDANCE WITH APPLICABLE AGREEMENTS.\r
\r
+ Copyright (c) 2013 AT&T Knowledge Ventures\r
+ Unpublished and Not for Publication\r
+ All Rights Reserved\r
+-->\r
<html>\r
<body>\r
<p>\r
-This package provides the JSON library.\r
+This package provides the json.org JSON library.\r
</p>\r
</body>\r
</html>\r