Package org.jooq.tools.json
Class JSONArray
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- org.jooq.tools.json.JSONArray
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable,java.util.Collection,java.util.List,java.util.RandomAccess
public class JSONArray extends java.util.ArrayListA JSON array. JSONObject supports java.util.List interface.- Author:
- FangYidong<fangyidong@yahoo.com.cn>
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringtoJSONString(java.util.List<?> list)Convert a list to JSON text.java.lang.StringtoString()static voidwriteJSONString(java.util.List<?> list, java.io.Writer out)Encode a list into JSON text and write it to out.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Constructor Detail
-
JSONArray
public JSONArray()
Constructs an empty JSONArray.
-
JSONArray
public JSONArray(java.util.Collection c)
Constructs a JSONArray containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
c- the collection whose elements are to be placed into this JSONArray
-
-
Method Detail
-
writeJSONString
public static void writeJSONString(java.util.List<?> list, java.io.Writer out) throws java.io.IOExceptionEncode a list into JSON text and write it to out.- Throws:
java.io.IOException- See Also:
JSONValue.writeJSONString(Object, Writer)
-
toJSONString
public static java.lang.String toJSONString(java.util.List<?> list)
Convert a list to JSON text. The result is a JSON array.- Returns:
- JSON text, or "null" if list is null.
- See Also:
JSONValue.toJSONString(Object)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection
-
-