net.minidev.json
Class JSONArray

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Object>
              extended by net.minidev.json.JSONArray
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, List<Object>, RandomAccess, JSONAware, JSONAwareEx, JSONStreamAware, JSONStreamAwareEx

public class JSONArray
extends ArrayList<Object>
implements List<Object>, JSONAwareEx, JSONStreamAwareEx

A JSON array. JSONObject supports java.util.List interface.

Author:
FangYidong, Uriel Chemouni
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
JSONArray()
           
 
Method Summary
 void merge(Object o2)
           
 String toJSONString()
          Explicitely Serialize Object as JSon String
 String toJSONString(JSONStyle compression)
           
static String toJSONString(List<? extends Object> list)
           
static String toJSONString(List<? extends Object> list, JSONStyle compression)
          Convert a list to JSON text.
 String toString()
          Override natif toStirng()
 String toString(JSONStyle compression)
          JSONAwareEx inferface
 void writeJSONString(Appendable out)
          write JSON string to out.
 void writeJSONString(Appendable out, JSONStyle compression)
          write JSON string to out.
static void writeJSONString(Iterable<? extends Object> list, Appendable out, JSONStyle compression)
          Encode a list into JSON text and write it to out.
static void writeJSONString(List<? extends Object> list, Appendable out)
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

JSONArray

public JSONArray()
Method Detail

toJSONString

public static String toJSONString(List<? extends Object> list)

toJSONString

public static String toJSONString(List<? extends Object> list,
                                  JSONStyle compression)
Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.

Parameters:
list -
compression - Indicate compression level
Returns:
JSON text, or "null" if list is null.
See Also:
JSONValue.toJSONString(Object)

writeJSONString

public static void writeJSONString(Iterable<? extends Object> list,
                                   Appendable out,
                                   JSONStyle compression)
                            throws IOException
Encode a list into JSON text and write it to out. If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level.

Parameters:
list -
out -
Throws:
IOException
See Also:
JSONValue.writeJSONString(Object, Appendable)

writeJSONString

public static void writeJSONString(List<? extends Object> list,
                                   Appendable out)
                            throws IOException
Throws:
IOException

merge

public void merge(Object o2)

toJSONString

public String toJSONString()
Explicitely Serialize Object as JSon String

Specified by:
toJSONString in interface JSONAware
Returns:
JSON text

toJSONString

public String toJSONString(JSONStyle compression)
Specified by:
toJSONString in interface JSONAwareEx
Returns:
JSON text

toString

public String toString()
Override natif toStirng()

Overrides:
toString in class AbstractCollection<Object>

toString

public String toString(JSONStyle compression)
JSONAwareEx inferface

Parameters:
compression - compression param

writeJSONString

public void writeJSONString(Appendable out)
                     throws IOException
Description copied from interface: JSONStreamAware
write JSON string to out.

Specified by:
writeJSONString in interface JSONStreamAware
Throws:
IOException

writeJSONString

public void writeJSONString(Appendable out,
                            JSONStyle compression)
                     throws IOException
Description copied from interface: JSONStreamAwareEx
write JSON string to out.

Specified by:
writeJSONString in interface JSONStreamAwareEx
Throws:
IOException


Copyright © 2012 Chemouni Uriel. All Rights Reserved.