亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jsonarray.java

?? 很好的json數據處理格式
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package org.json;/*Copyright (c) 2002 JSON.orgPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.The Software shall be used for Good, not Evil.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.*/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;/** * A JSONArray is an ordered sequence of values. Its external text form is a * string wrapped in square brackets with commas separating the values. The * internal form is an object having <code>get</code> and <code>opt</code> * methods for accessing the values by index, and <code>put</code> methods for * adding or replacing values. The values can be any of these types: * <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>, * <code>Number</code>, <code>String</code>, or the * <code>JSONObject.NULL object</code>. * <p> * The constructor can convert a JSON text into a Java object. The * <code>toString</code> method converts to JSON text. * <p> * A <code>get</code> method returns a value if one can be found, and throws an * exception if one cannot be found. An <code>opt</code> method returns a * default value instead of throwing an exception, and so is useful for * obtaining optional values. * <p> * The generic <code>get()</code> and <code>opt()</code> methods return an * object which you can cast or query for type. There are also typed * <code>get</code> and <code>opt</code> methods that do type checking and type * coercion for you. * <p> * The texts produced by the <code>toString</code> methods strictly conform to * JSON syntax rules. The constructors are more forgiving in the texts they will * accept: * <ul> * <li>An extra <code>,</code>&nbsp;<small>(comma)</small> may appear just *     before the closing bracket.</li> * <li>The <code>null</code> value will be inserted when there *     is <code>,</code>&nbsp;<small>(comma)</small> elision.</li> * <li>Strings may be quoted with <code>'</code>&nbsp;<small>(single *     quote)</small>.</li> * <li>Strings do not need to be quoted at all if they do not begin with a quote *     or single quote, and if they do not contain leading or trailing spaces, *     and if they do not contain any of these characters: *     <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers *     and if they are not the reserved words <code>true</code>, *     <code>false</code>, or <code>null</code>.</li> * <li>Values can be separated by <code>;</code> <small>(semicolon)</small> as *     well as by <code>,</code> <small>(comma)</small>.</li> * <li>Numbers may have the <code>0-</code> <small>(octal)</small> or *     <code>0x-</code> <small>(hex)</small> prefix.</li> * </ul> * @author JSON.org * @version 2008-09-18 */public class JSONArray {    /**     * The arrayList where the JSONArray's properties are kept.     */    private ArrayList myArrayList;    /**     * Construct an empty JSONArray.     */    public JSONArray() {        this.myArrayList = new ArrayList();    }    /**     * Construct a JSONArray from a JSONTokener.     * @param x A JSONTokener     * @throws JSONException If there is a syntax error.     */    public JSONArray(JSONTokener x) throws JSONException {        this();        char c = x.nextClean();        char q;        if (c == '[') {            q = ']';        } else if (c == '(') {            q = ')';        } else {            throw x.syntaxError("A JSONArray text must start with '['");        }        if (x.nextClean() == ']') {            return;        }        x.back();        for (;;) {            if (x.nextClean() == ',') {                x.back();                this.myArrayList.add(null);            } else {                x.back();                this.myArrayList.add(x.nextValue());            }            c = x.nextClean();            switch (c) {            case ';':            case ',':                if (x.nextClean() == ']') {                    return;                }                x.back();                break;            case ']':            case ')':                if (q != c) {                    throw x.syntaxError("Expected a '" + new Character(q) + "'");                }                return;            default:                throw x.syntaxError("Expected a ',' or ']'");            }        }    }    /**     * Construct a JSONArray from a source JSON text.     * @param source     A string that begins with     * <code>[</code>&nbsp;<small>(left bracket)</small>     *  and ends with <code>]</code>&nbsp;<small>(right bracket)</small>.     *  @throws JSONException If there is a syntax error.     */    public JSONArray(String source) throws JSONException {        this(new JSONTokener(source));    }    /**     * Construct a JSONArray from a Collection.     * @param collection     A Collection.     */    public JSONArray(Collection collection) {        this.myArrayList = (collection == null) ?            new ArrayList() :            new ArrayList(collection);    }    /**     * Construct a JSONArray from a collection of beans.     * The collection should have Java Beans.     *      * @throws JSONException If not an array.     */    public JSONArray(Collection collection,boolean includeSuperClass) {		this.myArrayList = new ArrayList();		if(collection != null) {			for (Iterator iter = collection.iterator(); iter.hasNext();) {				this.myArrayList.add(new JSONObject(iter.next(),includeSuperClass));				}		}    }        /**     * Construct a JSONArray from an array     * @throws JSONException If not an array.     */    public JSONArray(Object array) throws JSONException {        this();        if (array.getClass().isArray()) {            int length = Array.getLength(array);            for (int i = 0; i < length; i += 1) {                this.put(Array.get(array, i));            }        } else {            throw new JSONException("JSONArray initial value should be a string or collection or array.");        }    }    /**     * Construct a JSONArray from an array with a bean.     * The array should have Java Beans.     *      * @throws JSONException If not an array.     */    public JSONArray(Object array,boolean includeSuperClass) throws JSONException {        this();        if (array.getClass().isArray()) {            int length = Array.getLength(array);            for (int i = 0; i < length; i += 1) {                this.put(new JSONObject(Array.get(array, i),includeSuperClass));            }        } else {            throw new JSONException("JSONArray initial value should be a string or collection or array.");        }    }            /**     * Get the object value associated with an index.     * @param index     *  The index must be between 0 and length() - 1.     * @return An object value.     * @throws JSONException If there is no value for the index.     */    public Object get(int index) throws JSONException {        Object o = opt(index);        if (o == null) {            throw new JSONException("JSONArray[" + index + "] not found.");        }        return o;    }    /**     * Get the boolean value associated with an index.     * The string values "true" and "false" are converted to boolean.     *     * @param index The index must be between 0 and length() - 1.     * @return      The truth.     * @throws JSONException If there is no value for the index or if the     *  value is not convertable to boolean.     */    public boolean getBoolean(int index) throws JSONException {        Object o = get(index);        if (o.equals(Boolean.FALSE) ||                (o instanceof String &&                ((String)o).equalsIgnoreCase("false"))) {            return false;        } else if (o.equals(Boolean.TRUE) ||                (o instanceof String &&                ((String)o).equalsIgnoreCase("true"))) {            return true;        }        throw new JSONException("JSONArray[" + index + "] is not a Boolean.");    }    /**     * Get the double value associated with an index.     *     * @param index The index must be between 0 and length() - 1.     * @return      The value.     * @throws   JSONException If the key is not found or if the value cannot     *  be converted to a number.     */    public double getDouble(int index) throws JSONException {        Object o = get(index);        try {            return o instanceof Number ?                ((Number)o).doubleValue() :                Double.valueOf((String)o).doubleValue();        } catch (Exception e) {            throw new JSONException("JSONArray[" + index +                "] is not a number.");        }    }    /**     * Get the int value associated with an index.     *     * @param index The index must be between 0 and length() - 1.     * @return      The value.     * @throws   JSONException If the key is not found or if the value cannot     *  be converted to a number.     *  if the value cannot be converted to a number.     */    public int getInt(int index) throws JSONException {        Object o = get(index);        return o instanceof Number ?                ((Number)o).intValue() : (int)getDouble(index);    }    /**     * Get the JSONArray associated with an index.     * @param index The index must be between 0 and length() - 1.     * @return      A JSONArray value.     * @throws JSONException If there is no value for the index. or if the     * value is not a JSONArray     */    public JSONArray getJSONArray(int index) throws JSONException {        Object o = get(index);        if (o instanceof JSONArray) {            return (JSONArray)o;        }        throw new JSONException("JSONArray[" + index +                "] is not a JSONArray.");    }    /**     * Get the JSONObject associated with an index.     * @param index subscript     * @return      A JSONObject value.     * @throws JSONException If there is no value for the index or if the     * value is not a JSONObject     */    public JSONObject getJSONObject(int index) throws JSONException {        Object o = get(index);        if (o instanceof JSONObject) {            return (JSONObject)o;        }        throw new JSONException("JSONArray[" + index +            "] is not a JSONObject.");    }    /**     * Get the long value associated with an index.     *     * @param index The index must be between 0 and length() - 1.     * @return      The value.     * @throws   JSONException If the key is not found or if the value cannot     *  be converted to a number.     */    public long getLong(int index) throws JSONException {        Object o = get(index);        return o instanceof Number ?                ((Number)o).longValue() : (long)getDouble(index);    }    /**     * Get the string associated with an index.     * @param index The index must be between 0 and length() - 1.     * @return      A string value.     * @throws JSONException If there is no value for the index.     */    public String getString(int index) throws JSONException {        return get(index).toString();    }    /**     * Determine if the value is null.     * @param index The index must be between 0 and length() - 1.     * @return true if the value at the index is null, or if there is no value.     */    public boolean isNull(int index) {        return JSONObject.NULL.equals(opt(index));    }    /**     * Make a string from the contents of this JSONArray. The     * <code>separator</code> string is inserted between each element.     * Warning: This method assumes that the data structure is acyclical.     * @param separator A string that will be inserted between the elements.     * @return a string.     * @throws JSONException If the array contains an invalid number.     */    public String join(String separator) throws JSONException {        int len = length();        StringBuffer sb = new StringBuffer();        for (int i = 0; i < len; i += 1) {            if (i > 0) {                sb.append(separator);            }            sb.append(JSONObject.valueToString(this.myArrayList.get(i)));        }        return sb.toString();    }    /**     * Get the number of elements in the JSONArray, included nulls.     *     * @return The length (or size).     */    public int length() {        return this.myArrayList.size();    }    /**     * Get the optional object value associated with an index.     * @param index The index must be between 0 and length() - 1.     * @return      An object value, or null if there is no     *              object at that index.     */    public Object opt(int index) {        return (index < 0 || index >= length()) ?            null : this.myArrayList.get(index);    }    /**     * Get the optional boolean value associated with an index.     * It returns false if there is no value at that index,     * or if the value is not Boolean.TRUE or the String "true".     *     * @param index The index must be between 0 and length() - 1.     * @return      The truth.     */    public boolean optBoolean(int index)  {        return optBoolean(index, false);    }    /**     * Get the optional boolean value associated with an index.     * It returns the defaultValue if there is no value at that index or if     * it is not a Boolean or the String "true" or "false" (case insensitive).     *     * @param index The index must be between 0 and length() - 1.     * @param defaultValue     A boolean default.     * @return      The truth.     */    public boolean optBoolean(int index, boolean defaultValue)  {        try {            return getBoolean(index);        } catch (Exception e) {            return defaultValue;        }    }    /**     * Get the optional double value associated with an index.     * NaN is returned if there is no value for the index,     * or if the value is not a number and cannot be converted to a number.     *     * @param index The index must be between 0 and length() - 1.     * @return      The value.     */    public double optDouble(int index) {        return optDouble(index, Double.NaN);    }    /**     * Get the optional double value associated with an index.     * The defaultValue is returned if there is no value for the index,     * or if the value is not a number and cannot be converted to a number.     *     * @param index subscript     * @param defaultValue     The default value.     * @return      The value.     */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产综合在线| 国产日韩v精品一区二区| av在线不卡免费看| 国产精品亚洲一区二区三区在线| 免费欧美高清视频| 日韩1区2区日韩1区2区| 日本美女视频一区二区| 日韩精品一级中文字幕精品视频免费观看| 亚洲黄色av一区| 亚洲综合偷拍欧美一区色| 亚洲国产一二三| 日韩精品一二三| 久久精品国产久精国产| 国产一区二区调教| 成人影视亚洲图片在线| 91在线观看一区二区| 91国产福利在线| 91精品国产综合久久久久久久久久 | 成人性生交大合| 91最新地址在线播放| 欧美性做爰猛烈叫床潮| 91精品国产综合久久香蕉的特点| 日韩午夜在线观看视频| 久久久久久久免费视频了| 国产精品私人自拍| 亚洲精品菠萝久久久久久久| 亚洲国产美女搞黄色| 久久国产精品第一页| 国产**成人网毛片九色| 欧美亚洲一区二区在线观看| 欧美一二三区精品| 一区精品在线播放| 丝袜亚洲另类欧美综合| 国产成人免费视频精品含羞草妖精 | 日韩中文字幕91| 国产精品一区二区你懂的| 欧美在线一区二区| 精品国产髙清在线看国产毛片| 国产亲近乱来精品视频| 亚洲不卡av一区二区三区| 国产精品综合二区| 欧美视频一二三区| 欧美韩日一区二区三区| 日日夜夜精品视频天天综合网| 风间由美中文字幕在线看视频国产欧美| 色婷婷综合久久久久中文一区二区| 日韩一二在线观看| 亚洲男人的天堂在线aⅴ视频| 蜜臀久久99精品久久久久宅男 | 日韩中文字幕1| 99久久99精品久久久久久| 日韩欧美www| 一区二区三区在线影院| 成人福利在线看| 欧美r级在线观看| 午夜免费久久看| 91色综合久久久久婷婷| 欧美国产一区视频在线观看| 日韩国产精品久久久久久亚洲| 91麻豆国产福利在线观看| 久久久激情视频| 久久99精品久久久久| 欧美精品国产精品| 亚洲成人一区在线| 91成人国产精品| 亚洲丝袜另类动漫二区| 成人开心网精品视频| 国产女人aaa级久久久级| 精品一区二区三区免费播放| 欧美三级电影精品| 亚洲高清视频的网址| 色综合天天综合狠狠| 中文字幕一区二区三区乱码在线| 国产一区二区影院| 久久先锋影音av鲁色资源网| 久久国产精品99精品国产| 69久久99精品久久久久婷婷| 午夜精品久久久久久久久| 在线精品视频小说1| 亚洲欧美国产三级| 欧美性大战xxxxx久久久| 亚洲午夜免费福利视频| 欧美蜜桃一区二区三区| 日本在线观看不卡视频| 欧美日韩成人综合| 美国十次综合导航| 精品福利一区二区三区| 国产成人免费在线| 亚洲六月丁香色婷婷综合久久| 色综合天天综合狠狠| 亚洲福利国产精品| 日韩欧美久久一区| 国产一区二区伦理| 亚洲色图视频免费播放| 欧美日韩精品电影| 经典三级视频一区| 国产精品久久久久影院老司| 94-欧美-setu| 美女视频网站久久| 国产欧美视频一区二区| 一本大道久久精品懂色aⅴ| 亚洲国产成人av好男人在线观看| 91精品国产91综合久久蜜臀| 国内精品伊人久久久久影院对白| 久久久久国产免费免费| 91久久久免费一区二区| 免费在线看成人av| 国产视频一区二区在线观看| 色94色欧美sute亚洲线路一久| 日韩经典中文字幕一区| 欧美激情资源网| 欧美日韩精品一区二区天天拍小说| 精品综合免费视频观看| 中文字幕在线免费不卡| 欧美一区国产二区| 97精品视频在线观看自产线路二| 亚洲一区二区三区四区在线| 精品成人一区二区| 欧洲一区二区三区在线| 久久国产生活片100| 一区二区三区在线视频免费观看| 精品欧美一区二区三区精品久久| 91视频免费播放| 国产一区二区影院| 日韩在线观看一区二区| 亚洲激情五月婷婷| 国产女人aaa级久久久级| 在线播放国产精品二区一二区四区 | 久久久亚洲国产美女国产盗摄 | 蜜臀av性久久久久蜜臀av麻豆| 国产欧美一区二区三区网站| 欧美精品色一区二区三区| 99精品视频在线免费观看| 国产一区二区不卡老阿姨| 天天射综合影视| 亚洲免费观看高清在线观看| 91精品国产综合久久福利 | 免费在线成人网| 一区二区三区不卡视频| 亚洲国产成人午夜在线一区| 欧美成人精品高清在线播放| 欧美精品一级二级三级| 在线观看中文字幕不卡| 色狠狠av一区二区三区| 99久久精品国产毛片| 国产成人精品影院| 国产精品18久久久久久久网站| 免费久久精品视频| 免费的国产精品| 美女视频网站黄色亚洲| 美女性感视频久久| 欧美aⅴ一区二区三区视频| 秋霞av亚洲一区二区三| 日韩电影在线免费| 美女精品自拍一二三四| 久草精品在线观看| 黑人巨大精品欧美黑白配亚洲| 久久er99热精品一区二区| 久久精品国产77777蜜臀| 免费人成在线不卡| 久久精品国产亚洲一区二区三区| 久久精品国产亚洲高清剧情介绍 | 九色porny丨国产精品| 免费久久精品视频| 国产精品一区二区在线看| 国产超碰在线一区| www.在线欧美| 日本韩国欧美一区| 精品视频一区 二区 三区| 欧美精品乱码久久久久久| 日韩精品一区国产麻豆| www久久精品| 国产精品国产a级| 亚洲午夜私人影院| 精品亚洲成av人在线观看| 成人综合婷婷国产精品久久| 91在线免费播放| 欧美一级二级在线观看| 久久一夜天堂av一区二区三区| 国产精品久久久久久久久免费相片| 亚洲欧美日韩在线| 日韩av一区二| 成人丝袜高跟foot| 色综合久久88色综合天天| 欧美猛男男办公室激情| 久久婷婷国产综合精品青草| 亚洲人精品一区| 日韩中文字幕不卡| 不卡的av电影| 91精品综合久久久久久| 国产视频一区在线播放| 亚洲不卡在线观看| 福利一区二区在线观看| 欧美日韩一区二区三区高清| 久久久精品免费观看| 天天综合网天天综合色| 成人三级伦理片| 欧美成人欧美edvon| 一区二区三区四区中文字幕| 黑人巨大精品欧美黑白配亚洲|