json-20090211

16:38:10.953 INFO  jd.cli.Main - Decompiling json-20090211.jar
package org.json;

public class CDL
{
  private static String getValue(JSONTokener paramJSONTokener)
    throws JSONException
  {
    char c;
    do
    {
      c = paramJSONTokener.next();
    } while ((c == ' ') || (c == '\t'));
    switch (c)
    {
    case '\000': 
      return null;
    case '"': 
    case '\'': 
      return paramJSONTokener.nextString(c);
    case ',': 
      paramJSONTokener.back();
      return "";
    }
    paramJSONTokener.back();
    return paramJSONTokener.nextTo(',');
  }
  
  public static JSONArray rowToJSONArray(JSONTokener paramJSONTokener)
    throws JSONException
  {
    JSONArray localJSONArray = new JSONArray();
    for (;;)
    {
      String str = getValue(paramJSONTokener);
      if ((str == null) || ((localJSONArray.length() == 0) && (str.length() == 0))) {
        return null;
      }
      localJSONArray.put(str);
      for (;;)
      {
        char c = paramJSONTokener.next();
        if (c == ',') {
          break;
        }
        if (c != ' ')
        {
          if ((c == '\n') || (c == '\r') || (c == 0)) {
            return localJSONArray;
          }
          throw paramJSONTokener.syntaxError("Bad character '" + c + "' (" + c + ").");
        }
      }
    }
  }
  
  public static JSONObject rowToJSONObject(JSONArray paramJSONArray, JSONTokener paramJSONTokener)
    throws JSONException
  {
    JSONArray localJSONArray = rowToJSONArray(paramJSONTokener);
    return localJSONArray != null ? localJSONArray.toJSONObject(paramJSONArray) : null;
  }
  
  public static JSONArray toJSONArray(String paramString)
    throws JSONException
  {
    return toJSONArray(new JSONTokener(paramString));
  }
  
  public static JSONArray toJSONArray(JSONTokener paramJSONTokener)
    throws JSONException
  {
    return toJSONArray(rowToJSONArray(paramJSONTokener), paramJSONTokener);
  }
  
  public static JSONArray toJSONArray(JSONArray paramJSONArray, String paramString)
    throws JSONException
  {
    return toJSONArray(paramJSONArray, new JSONTokener(paramString));
  }
  
  public static JSONArray toJSONArray(JSONArray paramJSONArray, JSONTokener paramJSONTokener)
    throws JSONException
  {
    if ((paramJSONArray == null) || (paramJSONArray.length() == 0)) {
      return null;
    }
    JSONArray localJSONArray = new JSONArray();
    for (;;)
    {
      JSONObject localJSONObject = rowToJSONObject(paramJSONArray, paramJSONTokener);
      if (localJSONObject == null) {
        break;
      }
      localJSONArray.put(localJSONObject);
    }
    if (localJSONArray.length() == 0) {
      return null;
    }
    return localJSONArray;
  }
  
  public static String rowToString(JSONArray paramJSONArray)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < paramJSONArray.length(); i++)
    {
      if (i > 0) {
        localStringBuffer.append(',');
      }
      Object localObject = paramJSONArray.opt(i);
      if (localObject != null)
      {
        String str = localObject.toString();
        if (str.indexOf(',') >= 0)
        {
          if (str.indexOf('"') >= 0)
          {
            localStringBuffer.append('\'');
            localStringBuffer.append(str);
            localStringBuffer.append('\'');
          }
          else
          {
            localStringBuffer.append('"');
            localStringBuffer.append(str);
            localStringBuffer.append('"');
          }
        }
        else {
          localStringBuffer.append(str);
        }
      }
    }
    localStringBuffer.append('\n');
    return localStringBuffer.toString();
  }
  
  public static String toString(JSONArray paramJSONArray)
    throws JSONException
  {
    JSONObject localJSONObject = paramJSONArray.optJSONObject(0);
    if (localJSONObject != null)
    {
      JSONArray localJSONArray = localJSONObject.names();
      if (localJSONArray != null) {
        return rowToString(localJSONArray) + toString(localJSONArray, paramJSONArray);
      }
    }
    return null;
  }
  
  public static String toString(JSONArray paramJSONArray1, JSONArray paramJSONArray2)
    throws JSONException
  {
    if ((paramJSONArray1 == null) || (paramJSONArray1.length() == 0)) {
      return null;
    }
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < paramJSONArray2.length(); i++)
    {
      JSONObject localJSONObject = paramJSONArray2.optJSONObject(i);
      if (localJSONObject != null) {
        localStringBuffer.append(rowToString(localJSONObject.toJSONArray(paramJSONArray1)));
      }
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.json.CDL
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

public class Cookie
{
  public static String escape(String paramString)
  {
    String str = paramString.trim();
    StringBuffer localStringBuffer = new StringBuffer();
    int i = str.length();
    for (int j = 0; j < i; j++)
    {
      char c = str.charAt(j);
      if ((c < ' ') || (c == '+') || (c == '%') || (c == '=') || (c == ';'))
      {
        localStringBuffer.append('%');
        localStringBuffer.append(Character.forDigit((char)(c >>> '\004' & 0xF), 16));
        localStringBuffer.append(Character.forDigit((char)(c & 0xF), 16));
      }
      else
      {
        localStringBuffer.append(c);
      }
    }
    return localStringBuffer.toString();
  }
  
  public static JSONObject toJSONObject(String paramString)
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    
    JSONTokener localJSONTokener = new JSONTokener(paramString);
    localJSONObject.put("name", localJSONTokener.nextTo('='));
    localJSONTokener.next('=');
    localJSONObject.put("value", localJSONTokener.nextTo(';'));
    localJSONTokener.next();
    while (localJSONTokener.more())
    {
      String str = unescape(localJSONTokener.nextTo("=;"));
      Object localObject;
      if (localJSONTokener.next() != '=')
      {
        if (str.equals("secure")) {
          localObject = Boolean.TRUE;
        } else {
          throw localJSONTokener.syntaxError("Missing '=' in cookie parameter.");
        }
      }
      else
      {
        localObject = unescape(localJSONTokener.nextTo(';'));
        localJSONTokener.next();
      }
      localJSONObject.put(str, localObject);
    }
    return localJSONObject;
  }
  
  public static String toString(JSONObject paramJSONObject)
    throws JSONException
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    localStringBuffer.append(escape(paramJSONObject.getString("name")));
    localStringBuffer.append("=");
    localStringBuffer.append(escape(paramJSONObject.getString("value")));
    if (paramJSONObject.has("expires"))
    {
      localStringBuffer.append(";expires=");
      localStringBuffer.append(paramJSONObject.getString("expires"));
    }
    if (paramJSONObject.has("domain"))
    {
      localStringBuffer.append(";domain=");
      localStringBuffer.append(escape(paramJSONObject.getString("domain")));
    }
    if (paramJSONObject.has("path"))
    {
      localStringBuffer.append(";path=");
      localStringBuffer.append(escape(paramJSONObject.getString("path")));
    }
    if (paramJSONObject.optBoolean("secure")) {
      localStringBuffer.append(";secure");
    }
    return localStringBuffer.toString();
  }
  
  public static String unescape(String paramString)
  {
    int i = paramString.length();
    StringBuffer localStringBuffer = new StringBuffer();
    for (int j = 0; j < i; j++)
    {
      char c = paramString.charAt(j);
      if (c == '+')
      {
        c = ' ';
      }
      else if ((c == '%') && (j + 2 < i))
      {
        int k = JSONTokener.dehexchar(paramString.charAt(j + 1));
        int m = JSONTokener.dehexchar(paramString.charAt(j + 2));
        if ((k >= 0) && (m >= 0))
        {
          c = (char)(k * 16 + m);
          j += 2;
        }
      }
      localStringBuffer.append(c);
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.json.Cookie
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

import java.util.Iterator;

public class CookieList
{
  public static JSONObject toJSONObject(String paramString)
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    JSONTokener localJSONTokener = new JSONTokener(paramString);
    while (localJSONTokener.more())
    {
      String str = Cookie.unescape(localJSONTokener.nextTo('='));
      localJSONTokener.next('=');
      localJSONObject.put(str, Cookie.unescape(localJSONTokener.nextTo(';')));
      localJSONTokener.next();
    }
    return localJSONObject;
  }
  
  public static String toString(JSONObject paramJSONObject)
    throws JSONException
  {
    int i = 0;
    Iterator localIterator = paramJSONObject.keys();
    
    StringBuffer localStringBuffer = new StringBuffer();
    while (localIterator.hasNext())
    {
      String str = localIterator.next().toString();
      if (!paramJSONObject.isNull(str))
      {
        if (i != 0) {
          localStringBuffer.append(';');
        }
        localStringBuffer.append(Cookie.escape(str));
        localStringBuffer.append("=");
        localStringBuffer.append(Cookie.escape(paramJSONObject.getString(str)));
        i = 1;
      }
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.json.CookieList
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

import java.util.Iterator;

public class HTTP
{
  public static final String CRLF = "\r\n";
  
  public static JSONObject toJSONObject(String paramString)
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    HTTPTokener localHTTPTokener = new HTTPTokener(paramString);
    
    String str1 = localHTTPTokener.nextToken();
    if (str1.toUpperCase().startsWith("HTTP"))
    {
      localJSONObject.put("HTTP-Version", str1);
      localJSONObject.put("Status-Code", localHTTPTokener.nextToken());
      localJSONObject.put("Reason-Phrase", localHTTPTokener.nextTo('\000'));
      localHTTPTokener.next();
    }
    else
    {
      localJSONObject.put("Method", str1);
      localJSONObject.put("Request-URI", localHTTPTokener.nextToken());
      localJSONObject.put("HTTP-Version", localHTTPTokener.nextToken());
    }
    while (localHTTPTokener.more())
    {
      String str2 = localHTTPTokener.nextTo(':');
      localHTTPTokener.next(':');
      localJSONObject.put(str2, localHTTPTokener.nextTo('\000'));
      localHTTPTokener.next();
    }
    return localJSONObject;
  }
  
  public static String toString(JSONObject paramJSONObject)
    throws JSONException
  {
    Iterator localIterator = paramJSONObject.keys();
    
    StringBuffer localStringBuffer = new StringBuffer();
    if ((paramJSONObject.has("Status-Code")) && (paramJSONObject.has("Reason-Phrase")))
    {
      localStringBuffer.append(paramJSONObject.getString("HTTP-Version"));
      localStringBuffer.append(' ');
      localStringBuffer.append(paramJSONObject.getString("Status-Code"));
      localStringBuffer.append(' ');
      localStringBuffer.append(paramJSONObject.getString("Reason-Phrase"));
    }
    else if ((paramJSONObject.has("Method")) && (paramJSONObject.has("Request-URI")))
    {
      localStringBuffer.append(paramJSONObject.getString("Method"));
      localStringBuffer.append(' ');
      localStringBuffer.append('"');
      localStringBuffer.append(paramJSONObject.getString("Request-URI"));
      localStringBuffer.append('"');
      localStringBuffer.append(' ');
      localStringBuffer.append(paramJSONObject.getString("HTTP-Version"));
    }
    else
    {
      throw new JSONException("Not enough material for an HTTP header.");
    }
    localStringBuffer.append("\r\n");
    while (localIterator.hasNext())
    {
      String str = localIterator.next().toString();
      if ((!str.equals("HTTP-Version")) && (!str.equals("Status-Code")) && (!str.equals("Reason-Phrase")) && (!str.equals("Method")) && (!str.equals("Request-URI")) && (!paramJSONObject.isNull(str)))
      {
        localStringBuffer.append(str);
        localStringBuffer.append(": ");
        localStringBuffer.append(paramJSONObject.getString(str));
        localStringBuffer.append("\r\n");
      }
    }
    localStringBuffer.append("\r\n");
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.json.HTTP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

public class HTTPTokener
  extends JSONTokener
{
  public HTTPTokener(String paramString)
  {
    super(paramString);
  }
  
  public String nextToken()
    throws JSONException
  {
    StringBuffer localStringBuffer = new StringBuffer();
    char c1;
    do
    {
      c1 = next();
    } while (Character.isWhitespace(c1));
    if ((c1 == '"') || (c1 == '\''))
    {
      char c2 = c1;
      for (;;)
      {
        c1 = next();
        if (c1 < ' ') {
          throw syntaxError("Unterminated string.");
        }
        if (c1 == c2) {
          return localStringBuffer.toString();
        }
        localStringBuffer.append(c1);
      }
    }
    for (;;)
    {
      if ((c1 == 0) || (Character.isWhitespace(c1))) {
        return localStringBuffer.toString();
      }
      localStringBuffer.append(c1);
      c1 = next();
    }
  }
}

/* Location:
 * Qualified Name:     org.json.HTTPTokener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

public class JSONArray
{
  private ArrayList myArrayList;
  
  public JSONArray()
  {
    myArrayList = new ArrayList();
  }
  
  public JSONArray(JSONTokener paramJSONTokener)
    throws JSONException
  {
    this();
    int i = paramJSONTokener.nextClean();
    char c;
    if (i == 91) {
      c = ']';
    } else if (i == 40) {
      c = ')';
    } else {
      throw paramJSONTokener.syntaxError("A JSONArray text must start with '['");
    }
    if (paramJSONTokener.nextClean() == ']') {
      return;
    }
    paramJSONTokener.back();
    for (;;)
    {
      if (paramJSONTokener.nextClean() == ',')
      {
        paramJSONTokener.back();
        myArrayList.add(null);
      }
      else
      {
        paramJSONTokener.back();
        myArrayList.add(paramJSONTokener.nextValue());
      }
      i = paramJSONTokener.nextClean();
      switch (i)
      {
      case 44: 
      case 59: 
        if (paramJSONTokener.nextClean() == ']') {
          return;
        }
        paramJSONTokener.back();
      }
    }
    if (c != i) {
      throw paramJSONTokener.syntaxError("Expected a '" + new Character(c) + "'");
    }
    return;
    
    throw paramJSONTokener.syntaxError("Expected a ',' or ']'");
  }
  
  public JSONArray(String paramString)
    throws JSONException
  {
    this(new JSONTokener(paramString));
  }
  
  public JSONArray(Collection paramCollection)
  {
    myArrayList = (paramCollection == null ? new ArrayList() : new ArrayList(paramCollection));
  }
  
  public JSONArray(Collection paramCollection, boolean paramBoolean)
  {
    myArrayList = new ArrayList();
    Iterator localIterator;
    if (paramCollection != null) {
      for (localIterator = paramCollection.iterator(); localIterator.hasNext();) {
        myArrayList.add(new JSONObject(localIterator.next(), paramBoolean));
      }
    }
  }
  
  public JSONArray(Object paramObject)
    throws JSONException
  {
    this();
    if (paramObject.getClass().isArray())
    {
      int i = Array.getLength(paramObject);
      for (int j = 0; j < i; j++) {
        put(Array.get(paramObject, j));
      }
    }
    else
    {
      throw new JSONException("JSONArray initial value should be a string or collection or array.");
    }
  }
  
  public JSONArray(Object paramObject, boolean paramBoolean)
    throws JSONException
  {
    this();
    if (paramObject.getClass().isArray())
    {
      int i = Array.getLength(paramObject);
      for (int j = 0; j < i; j++) {
        put(new JSONObject(Array.get(paramObject, j), paramBoolean));
      }
    }
    else
    {
      throw new JSONException("JSONArray initial value should be a string or collection or array.");
    }
  }
  
  public Object get(int paramInt)
    throws JSONException
  {
    Object localObject = opt(paramInt);
    if (localObject == null) {
      throw new JSONException("JSONArray[" + paramInt + "] not found.");
    }
    return localObject;
  }
  
  public boolean getBoolean(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    if ((localObject.equals(Boolean.FALSE)) || (((localObject instanceof String)) && (((String)localObject).equalsIgnoreCase("false")))) {
      return false;
    }
    if ((localObject.equals(Boolean.TRUE)) || (((localObject instanceof String)) && (((String)localObject).equalsIgnoreCase("true")))) {
      return true;
    }
    throw new JSONException("JSONArray[" + paramInt + "] is not a Boolean.");
  }
  
  public double getDouble(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    try
    {
      return (localObject instanceof Number) ? ((Number)localObject).doubleValue() : Double.valueOf((String)localObject).doubleValue();
    }
    catch (Exception localException)
    {
      throw new JSONException("JSONArray[" + paramInt + "] is not a number.");
    }
  }
  
  public int getInt(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    return (localObject instanceof Number) ? ((Number)localObject).intValue() : (int)getDouble(paramInt);
  }
  
  public JSONArray getJSONArray(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    if ((localObject instanceof JSONArray)) {
      return (JSONArray)localObject;
    }
    throw new JSONException("JSONArray[" + paramInt + "] is not a JSONArray.");
  }
  
  public JSONObject getJSONObject(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    if ((localObject instanceof JSONObject)) {
      return (JSONObject)localObject;
    }
    throw new JSONException("JSONArray[" + paramInt + "] is not a JSONObject.");
  }
  
  public long getLong(int paramInt)
    throws JSONException
  {
    Object localObject = get(paramInt);
    return (localObject instanceof Number) ? ((Number)localObject).longValue() : getDouble(paramInt);
  }
  
  public String getString(int paramInt)
    throws JSONException
  {
    return get(paramInt).toString();
  }
  
  public boolean isNull(int paramInt)
  {
    return JSONObject.NULL.equals(opt(paramInt));
  }
  
  public String join(String paramString)
    throws JSONException
  {
    int i = length();
    StringBuffer localStringBuffer = new StringBuffer();
    for (int j = 0; j < i; j++)
    {
      if (j > 0) {
        localStringBuffer.append(paramString);
      }
      localStringBuffer.append(JSONObject.valueToString(myArrayList.get(j)));
    }
    return localStringBuffer.toString();
  }
  
  public int length()
  {
    return myArrayList.size();
  }
  
  public Object opt(int paramInt)
  {
    return (paramInt < 0) || (paramInt >= length()) ? null : myArrayList.get(paramInt);
  }
  
  public boolean optBoolean(int paramInt)
  {
    return optBoolean(paramInt, false);
  }
  
  public boolean optBoolean(int paramInt, boolean paramBoolean)
  {
    try
    {
      return getBoolean(paramInt);
    }
    catch (Exception localException) {}
    return paramBoolean;
  }
  
  public double optDouble(int paramInt)
  {
    return optDouble(paramInt, NaN.0D);
  }
  
  public double optDouble(int paramInt, double paramDouble)
  {
    try
    {
      return getDouble(paramInt);
    }
    catch (Exception localException) {}
    return paramDouble;
  }
  
  public int optInt(int paramInt)
  {
    return optInt(paramInt, 0);
  }
  
  public int optInt(int paramInt1, int paramInt2)
  {
    try
    {
      return getInt(paramInt1);
    }
    catch (Exception localException) {}
    return paramInt2;
  }
  
  public JSONArray optJSONArray(int paramInt)
  {
    Object localObject = opt(paramInt);
    return (localObject instanceof JSONArray) ? (JSONArray)localObject : null;
  }
  
  public JSONObject optJSONObject(int paramInt)
  {
    Object localObject = opt(paramInt);
    return (localObject instanceof JSONObject) ? (JSONObject)localObject : null;
  }
  
  public long optLong(int paramInt)
  {
    return optLong(paramInt, 0L);
  }
  
  public long optLong(int paramInt, long paramLong)
  {
    try
    {
      return getLong(paramInt);
    }
    catch (Exception localException) {}
    return paramLong;
  }
  
  public String optString(int paramInt)
  {
    return optString(paramInt, "");
  }
  
  public String optString(int paramInt, String paramString)
  {
    Object localObject = opt(paramInt);
    return localObject != null ? localObject.toString() : paramString;
  }
  
  public JSONArray put(boolean paramBoolean)
  {
    put(paramBoolean ? Boolean.TRUE : Boolean.FALSE);
    return this;
  }
  
  public JSONArray put(Collection paramCollection)
  {
    put(new JSONArray(paramCollection));
    return this;
  }
  
  public JSONArray put(double paramDouble)
    throws JSONException
  {
    Double localDouble = new Double(paramDouble);
    JSONObject.testValidity(localDouble);
    put(localDouble);
    return this;
  }
  
  public JSONArray put(int paramInt)
  {
    put(new Integer(paramInt));
    return this;
  }
  
  public JSONArray put(long paramLong)
  {
    put(new Long(paramLong));
    return this;
  }
  
  public JSONArray put(Map paramMap)
  {
    put(new JSONObject(paramMap));
    return this;
  }
  
  public JSONArray put(Object paramObject)
  {
    myArrayList.add(paramObject);
    return this;
  }
  
  public JSONArray put(int paramInt, boolean paramBoolean)
    throws JSONException
  {
    put(paramInt, paramBoolean ? Boolean.TRUE : Boolean.FALSE);
    return this;
  }
  
  public JSONArray put(int paramInt, Collection paramCollection)
    throws JSONException
  {
    put(paramInt, new JSONArray(paramCollection));
    return this;
  }
  
  public JSONArray put(int paramInt, double paramDouble)
    throws JSONException
  {
    put(paramInt, new Double(paramDouble));
    return this;
  }
  
  public JSONArray put(int paramInt1, int paramInt2)
    throws JSONException
  {
    put(paramInt1, new Integer(paramInt2));
    return this;
  }
  
  public JSONArray put(int paramInt, long paramLong)
    throws JSONException
  {
    put(paramInt, new Long(paramLong));
    return this;
  }
  
  public JSONArray put(int paramInt, Map paramMap)
    throws JSONException
  {
    put(paramInt, new JSONObject(paramMap));
    return this;
  }
  
  public JSONArray put(int paramInt, Object paramObject)
    throws JSONException
  {
    JSONObject.testValidity(paramObject);
    if (paramInt < 0) {
      throw new JSONException("JSONArray[" + paramInt + "] not found.");
    }
    if (paramInt < length())
    {
      myArrayList.set(paramInt, paramObject);
    }
    else
    {
      while (paramInt != length()) {
        put(JSONObject.NULL);
      }
      put(paramObject);
    }
    return this;
  }
  
  public JSONObject toJSONObject(JSONArray paramJSONArray)
    throws JSONException
  {
    if ((paramJSONArray == null) || (paramJSONArray.length() == 0) || (length() == 0)) {
      return null;
    }
    JSONObject localJSONObject = new JSONObject();
    for (int i = 0; i < paramJSONArray.length(); i++) {
      localJSONObject.put(paramJSONArray.getString(i), opt(i));
    }
    return localJSONObject;
  }
  
  public String toString()
  {
    try
    {
      return '[' + join(",") + ']';
    }
    catch (Exception localException) {}
    return null;
  }
  
  public String toString(int paramInt)
    throws JSONException
  {
    return toString(paramInt, 0);
  }
  
  String toString(int paramInt1, int paramInt2)
    throws JSONException
  {
    int i = length();
    if (i == 0) {
      return "[]";
    }
    StringBuffer localStringBuffer = new StringBuffer("[");
    if (i == 1)
    {
      localStringBuffer.append(JSONObject.valueToString(myArrayList.get(0), paramInt1, paramInt2));
    }
    else
    {
      int k = paramInt2 + paramInt1;
      localStringBuffer.append('\n');
      for (int j = 0; j < i; j++)
      {
        if (j > 0) {
          localStringBuffer.append(",\n");
        }
        for (int m = 0; m < k; m++) {
          localStringBuffer.append(' ');
        }
        localStringBuffer.append(JSONObject.valueToString(myArrayList.get(j), paramInt1, k));
      }
      localStringBuffer.append('\n');
      for (j = 0; j < paramInt2; j++) {
        localStringBuffer.append(' ');
      }
    }
    localStringBuffer.append(']');
    return localStringBuffer.toString();
  }
  
  public Writer write(Writer paramWriter)
    throws JSONException
  {
    try
    {
      int i = 0;
      int j = length();
      
      paramWriter.write(91);
      for (int k = 0; k < j; k++)
      {
        if (i != 0) {
          paramWriter.write(44);
        }
        Object localObject = myArrayList.get(k);
        if ((localObject instanceof JSONObject)) {
          ((JSONObject)localObject).write(paramWriter);
        } else if ((localObject instanceof JSONArray)) {
          ((JSONArray)localObject).write(paramWriter);
        } else {
          paramWriter.write(JSONObject.valueToString(localObject));
        }
        i = 1;
      }
      paramWriter.write(93);
      return paramWriter;
    }
    catch (IOException localIOException)
    {
      throw new JSONException(localIOException);
    }
  }
}

/* Location:
 * Qualified Name:     org.json.JSONArray
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

public class JSONException
  extends Exception
{
  private Throwable cause;
  
  public JSONException(String paramString)
  {
    super(paramString);
  }
  
  public JSONException(Throwable paramThrowable)
  {
    super(paramThrowable.getMessage());
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

/* Location:
 * Qualified Name:     org.json.JSONException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

import java.util.Iterator;

public class JSONML
{
  private static Object parse(XMLTokener paramXMLTokener, boolean paramBoolean, JSONArray paramJSONArray)
    throws JSONException
  {
    String str2 = null;
    
    JSONArray localJSONArray = null;
    JSONObject localJSONObject = null;
    
    String str3 = null;
    for (;;)
    {
      Object localObject = paramXMLTokener.nextContent();
      if (localObject == XML.LT)
      {
        localObject = paramXMLTokener.nextToken();
        if ((localObject instanceof Character))
        {
          if (localObject == XML.SLASH)
          {
            localObject = paramXMLTokener.nextToken();
            if (!(localObject instanceof String)) {
              throw new JSONException("Expected a closing name instead of '" + localObject + "'.");
            }
            if (paramXMLTokener.nextToken() != XML.GT) {
              throw paramXMLTokener.syntaxError("Misshaped close tag");
            }
            return localObject;
          }
          if (localObject == XML.BANG)
          {
            int i = paramXMLTokener.next();
            if (i == 45)
            {
              if (paramXMLTokener.next() == '-') {
                paramXMLTokener.skipPast("-->");
              }
              paramXMLTokener.back();
            }
            else if (i == 91)
            {
              localObject = paramXMLTokener.nextToken();
              if ((localObject.equals("CDATA")) && (paramXMLTokener.next() == '['))
              {
                if (paramJSONArray != null) {
                  paramJSONArray.put(paramXMLTokener.nextCDATA());
                }
              }
              else {
                throw paramXMLTokener.syntaxError("Expected 'CDATA['");
              }
            }
            else
            {
              int j = 1;
              do
              {
                localObject = paramXMLTokener.nextMeta();
                if (localObject == null) {
                  throw paramXMLTokener.syntaxError("Missing '>' after '<!'.");
                }
                if (localObject == XML.LT) {
                  j++;
                } else if (localObject == XML.GT) {
                  j--;
                }
              } while (j > 0);
            }
          }
          else if (localObject == XML.QUEST)
          {
            paramXMLTokener.skipPast("?>");
          }
          else
          {
            throw paramXMLTokener.syntaxError("Misshaped tag");
          }
        }
        else
        {
          if (!(localObject instanceof String)) {
            throw paramXMLTokener.syntaxError("Bad tagName '" + localObject + "'.");
          }
          str3 = (String)localObject;
          localJSONArray = new JSONArray();
          localJSONObject = new JSONObject();
          if (paramBoolean)
          {
            localJSONArray.put(str3);
            if (paramJSONArray != null) {
              paramJSONArray.put(localJSONArray);
            }
          }
          else
          {
            localJSONObject.put("tagName", str3);
            if (paramJSONArray != null) {
              paramJSONArray.put(localJSONObject);
            }
          }
          localObject = null;
          for (;;)
          {
            if (localObject == null) {
              localObject = paramXMLTokener.nextToken();
            }
            if (localObject == null) {
              throw paramXMLTokener.syntaxError("Misshaped tag");
            }
            if (!(localObject instanceof String)) {
              break;
            }
            String str1 = (String)localObject;
            if ((!paramBoolean) && ((str1 == "tagName") || (str1 == "childNode"))) {
              throw paramXMLTokener.syntaxError("Reserved attribute.");
            }
            localObject = paramXMLTokener.nextToken();
            if (localObject == XML.EQ)
            {
              localObject = paramXMLTokener.nextToken();
              if (!(localObject instanceof String)) {
                throw paramXMLTokener.syntaxError("Missing value");
              }
              localJSONObject.accumulate(str1, JSONObject.stringToValue((String)localObject));
              localObject = null;
            }
            else
            {
              localJSONObject.accumulate(str1, "");
            }
          }
          if ((paramBoolean) && (localJSONObject.length() > 0)) {
            localJSONArray.put(localJSONObject);
          }
          if (localObject == XML.SLASH)
          {
            if (paramXMLTokener.nextToken() != XML.GT) {
              throw paramXMLTokener.syntaxError("Misshaped tag");
            }
            if (paramJSONArray == null)
            {
              if (paramBoolean) {
                return localJSONArray;
              }
              return localJSONObject;
            }
          }
          else
          {
            if (localObject != XML.GT) {
              throw paramXMLTokener.syntaxError("Misshaped tag");
            }
            str2 = (String)parse(paramXMLTokener, paramBoolean, localJSONArray);
            if (str2 != null)
            {
              if (!str2.equals(str3)) {
                throw paramXMLTokener.syntaxError("Mismatched '" + str3 + "' and '" + str2 + "'");
              }
              str3 = null;
              if ((!paramBoolean) && (localJSONArray.length() > 0)) {
                localJSONObject.put("childNodes", localJSONArray);
              }
              if (paramJSONArray == null)
              {
                if (paramBoolean) {
                  return localJSONArray;
                }
                return localJSONObject;
              }
            }
          }
        }
      }
      else if (paramJSONArray != null)
      {
        paramJSONArray.put((localObject instanceof String) ? JSONObject.stringToValue((String)localObject) : localObject);
      }
    }
  }
  
  public static JSONArray toJSONArray(String paramString)
    throws JSONException
  {
    return toJSONArray(new XMLTokener(paramString));
  }
  
  public static JSONArray toJSONArray(XMLTokener paramXMLTokener)
    throws JSONException
  {
    return (JSONArray)parse(paramXMLTokener, true, null);
  }
  
  public static JSONObject toJSONObject(XMLTokener paramXMLTokener)
    throws JSONException
  {
    return (JSONObject)parse(paramXMLTokener, false, null);
  }
  
  public static JSONObject toJSONObject(String paramString)
    throws JSONException
  {
    return toJSONObject(new XMLTokener(paramString));
  }
  
  public static String toString(JSONArray paramJSONArray)
    throws JSONException
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    String str2 = paramJSONArray.getString(0);
    XML.noSpace(str2);
    str2 = XML.escape(str2);
    localStringBuffer.append('<');
    localStringBuffer.append(str2);
    
    Object localObject = paramJSONArray.opt(1);
    if ((localObject instanceof JSONObject))
    {
      i = 2;
      JSONObject localJSONObject = (JSONObject)localObject;
      
      Iterator localIterator = localJSONObject.keys();
      while (localIterator.hasNext())
      {
        String str1 = localIterator.next().toString();
        XML.noSpace(str1);
        String str3 = localJSONObject.optString(str1);
        if (str3 != null)
        {
          localStringBuffer.append(' ');
          localStringBuffer.append(XML.escape(str1));
          localStringBuffer.append('=');
          localStringBuffer.append('"');
          localStringBuffer.append(XML.escape(str3));
          localStringBuffer.append('"');
        }
      }
    }
    int i = 1;
    
    int j = paramJSONArray.length();
    if (i >= j)
    {
      localStringBuffer.append('/');
      localStringBuffer.append('>');
    }
    else
    {
      localStringBuffer.append('>');
      do
      {
        localObject = paramJSONArray.get(i);
        i++;
        if (localObject != null) {
          if ((localObject instanceof String)) {
            localStringBuffer.append(XML.escape(localObject.toString()));
          } else if ((localObject instanceof JSONObject)) {
            localStringBuffer.append(toString((JSONObject)localObject));
          } else if ((localObject instanceof JSONArray)) {
            localStringBuffer.append(toString((JSONArray)localObject));
          }
        }
      } while (i < j);
      localStringBuffer.append('<');
      localStringBuffer.append('/');
      localStringBuffer.append(str2);
      localStringBuffer.append('>');
    }
    return localStringBuffer.toString();
  }
  
  public static String toString(JSONObject paramJSONObject)
    throws JSONException
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    String str2 = paramJSONObject.optString("tagName");
    if (str2 == null) {
      return XML.escape(paramJSONObject.toString());
    }
    XML.noSpace(str2);
    str2 = XML.escape(str2);
    localStringBuffer.append('<');
    localStringBuffer.append(str2);
    
    Iterator localIterator = paramJSONObject.keys();
    while (localIterator.hasNext())
    {
      String str1 = localIterator.next().toString();
      if ((!str1.equals("tagName")) && (!str1.equals("childNodes")))
      {
        XML.noSpace(str1);
        String str3 = paramJSONObject.optString(str1);
        if (str3 != null)
        {
          localStringBuffer.append(' ');
          localStringBuffer.append(XML.escape(str1));
          localStringBuffer.append('=');
          localStringBuffer.append('"');
          localStringBuffer.append(XML.escape(str3));
          localStringBuffer.append('"');
        }
      }
    }
    JSONArray localJSONArray = paramJSONObject.optJSONArray("childNodes");
    if (localJSONArray == null)
    {
      localStringBuffer.append('/');
      localStringBuffer.append('>');
    }
    else
    {
      localStringBuffer.append('>');
      int j = localJSONArray.length();
      for (int i = 0; i < j; i++)
      {
        Object localObject = localJSONArray.get(i);
        if (localObject != null) {
          if ((localObject instanceof String)) {
            localStringBuffer.append(XML.escape(localObject.toString()));
          } else if ((localObject instanceof JSONObject)) {
            localStringBuffer.append(toString((JSONObject)localObject));
          } else if ((localObject instanceof JSONArray)) {
            localStringBuffer.append(toString((JSONArray)localObject));
          }
        }
      }
      localStringBuffer.append('<');
      localStringBuffer.append('/');
      localStringBuffer.append(str2);
      localStringBuffer.append('>');
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.json.JSONML
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

class JSONObject$1 {}

/* Location:
 * Qualified Name:     org.json.JSONObject.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

final class JSONObject$Null
{
  protected final Object clone()
  {
    return this;
  }
  
  public boolean equals(Object paramObject)
  {
    return (paramObject == null) || (paramObject == this);
  }
  
  public String toString()
  {
    return "null";
  }
}

/* Location:
 * Qualified Name:     org.json.JSONObject.Null
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.json;

import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;

public class JSONObject
{
  private Map map;
  
  private static final class Null
  {
    protected final Object clone()
    {
      return this;
    }
    
    public boolean equals(Object paramObject)
    {
      return (paramObject == null) || (paramObject == this);
    }
    
    public String toString()
    {
      return "null";
    }
  }
  
  public static final Object NULL = new Null(null);
  
  public JSONObject()
  {
    map = new HashMap();
  }
  
  public JSONObject(JSONObject paramJSONObject, String[] paramArrayOfString)
    throws JSONException
  {
    this();
    for (int i = 0; i < paramArrayOfString.length; i++) {
      putOnce(paramArrayOfString[i], paramJSONObject.opt(paramArrayOfString[i]));
    }
  }
  
  public JSONObject(JSONTokener paramJSONTokener)
    throws JSONException
  {
    this();
    if (paramJSONTokener.nextClean() != '{') {
      throw paramJSONTokener.syntaxError("A JSONObject text must begin with '{'");
    }
    for (;;)
    {
      int i = paramJSONTokener.nextClean();
      switch (i)
      {
      case 0: 
        throw paramJSONTokener.syntaxError("A JSONObject text must end with '}'");
      case 125: 
        return;
      }
      paramJSONTokener.back();
      String str = paramJSONTokener.nextValue().toString();
      
      i = paramJSONTokener.nextClean();
      if (i == 61)
      {
        if (paramJSONTokener.next() != '>') {
          paramJSONTokener.back();
        }
      }
      else if (i != 58) {
        throw paramJSONTokener.syntaxError("Expected a ':' after a key");
      }
      putOnce(str, paramJSONTokener.nextValue());
      switch (paramJSONTokener.nextClean())
      {
      case ',': 
      case ';': 
        if (paramJSONTokener.nextClean() == '}') {
          return;
        }
        paramJSONTokener.back();
      
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd