public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware
modCount| 构造器和说明 |
|---|
JSONArray()
Constructs an empty JSONArray.
|
JSONArray(Collection c)
Constructs a JSONArray containing the elements of the specified
collection, in the order they are returned by the collection's iterator.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int index,
Object object) |
boolean |
add(Object object) |
boolean |
addAll(Collection collection) |
boolean |
addAll(int index,
Collection collection) |
Object |
get(int index)
Get the object value associated with an index.
|
BigDecimal |
getBigDecimal(int index)
Get the BigDecimal value associated with an index.
|
BigInteger |
getBigInteger(int index)
Get the BigInteger value associated with an index.
|
boolean |
getBoolean(int index)
Get the boolean value associated with an index.
|
double |
getDouble(int index)
Get the double value associated with an index.
|
int |
getInt(int index)
Get the int value associated with an index.
|
JSONArray |
getJSONArray(int index)
Get the JSONArray associated with an index.
|
JSONObject |
getJSONObject(int index)
Get the JSONObject associated with an index.
|
long |
getLong(int index)
Get the long value associated with an index.
|
String |
getString(int index)
Get the string associated with an index.
|
String |
toJSONString() |
static String |
toJSONString(boolean[] array) |
static String |
toJSONString(byte[] array) |
static String |
toJSONString(char[] array) |
static String |
toJSONString(Collection collection)
Convert a list to JSON text.
|
static String |
toJSONString(double[] array) |
static String |
toJSONString(float[] array) |
static String |
toJSONString(int[] array) |
static String |
toJSONString(long[] array) |
static String |
toJSONString(Object[] array) |
static String |
toJSONString(short[] array) |
String |
toString()
Returns a string representation of this array.
|
static void |
writeJSONString(boolean[] array,
Writer out) |
static void |
writeJSONString(byte[] array,
Writer out) |
static void |
writeJSONString(char[] array,
Writer out) |
static void |
writeJSONString(Collection collection,
Writer out)
Encode a list into JSON text and write it to out.
|
static void |
writeJSONString(double[] array,
Writer out) |
static void |
writeJSONString(float[] array,
Writer out) |
static void |
writeJSONString(int[] array,
Writer out) |
static void |
writeJSONString(long[] array,
Writer out) |
static void |
writeJSONString(Object[] array,
Writer out) |
static void |
writeJSONString(short[] array,
Writer out) |
void |
writeJSONString(Writer out)
write JSON string to out.
|
clear, clone, contains, ensureCapacity, forEach, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAllcontainsAll, equals, hashCodeparallelStream, streampublic JSONArray()
public JSONArray(Collection c)
c - the collection whose elements are to be placed into this JSONArraypublic boolean add(Object object)
public boolean addAll(Collection collection)
public boolean addAll(int index,
Collection collection)
public static void writeJSONString(Collection collection, Writer out) throws IOException
collection - out - IOExceptionblade.kit.json2.JSONValue#writeJSONString(Object, Writer)public void writeJSONString(Writer out) throws IOException
JSONStreamAwarewriteJSONString 在接口中 JSONStreamAwareIOExceptionpublic static String toJSONString(Collection collection)
collection - blade.kit.json2.JSONValue#toJSONString(Object)public static void writeJSONString(byte[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(byte[] array)
public static void writeJSONString(short[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(short[] array)
public static void writeJSONString(int[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(int[] array)
public static void writeJSONString(long[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(long[] array)
public static void writeJSONString(float[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(float[] array)
public static void writeJSONString(double[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(double[] array)
public static void writeJSONString(boolean[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(boolean[] array)
public static void writeJSONString(char[] array,
Writer out)
throws IOException
IOExceptionpublic static String toJSONString(char[] array)
public static void writeJSONString(Object[] array, Writer out) throws IOException
IOExceptionpublic String toJSONString()
toJSONString 在接口中 JSONAwarepublic String toString()
toJSONString().toString 在类中 AbstractCollectionpublic Object get(int index) throws JSONException
get 在接口中 Listget 在类中 ArrayListindex - The index must be between 0 and length() - 1.JSONException - If there is no value for the index.public boolean getBoolean(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no value for the index or if the value is not
convertible to boolean.public double getDouble(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted
to a number.public BigDecimal getBigDecimal(int index) throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted
to a BigDecimal.public BigInteger getBigInteger(int index) throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted
to a BigInteger.public int getInt(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value is not a number.public JSONArray getJSONArray(int index) throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no value for the index. or if the value is not a
JSONArraypublic JSONObject getJSONObject(int index) throws JSONException
index - subscriptJSONException - If there is no value for the index or if the value is not a
JSONObjectpublic long getLong(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted
to a number.public String getString(int index) throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no string value for the index.Copyright © 2015. All rights reserved.