Package com.ibm.json.java
Class JSONArray
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
com.ibm.json.java.JSONArray
- All Implemented Interfaces:
- JSONArtifact,- Serializable,- Cloneable,- Iterable,- Collection,- List,- RandomAccess
Extension of ArrayList that only allows values which are JSON-able.  
 See JSONObject for a list of valid values.
 
 Instances of this class are not thread-safe.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection collection) booleanaddAll(Collection collection) static JSONArrayparse(InputStream is) Convert a stream of JSONArray text into JSONArray form.static JSONArrayConvert a stream (in reader form) of JSONArray text into object form.static JSONArrayConvert a String of JSONArray text into object form.Convert this object into a String of JSON text.serialize(boolean verbose) Convert this object into a String of JSON text, specifying verbosity.voidConvert this object into a stream of JSON text.voidserialize(OutputStream os, boolean verbose) Convert this object into a stream of JSON text.voidConvert this object into a stream of JSON text.voidConvert this object into a stream of JSON text, specifying verbosity.Methods inherited from class java.util.ArrayListclear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractListequals, hashCodeMethods inherited from class java.util.AbstractCollectioncontainsAll, toStringMethods inherited from interface java.util.CollectionparallelStream, streamMethods inherited from interface java.util.ListcontainsAll, equals, hashCode
- 
Constructor Details- 
JSONArraypublic JSONArray()Create a new instance of this class.
- 
JSONArraypublic JSONArray(int initialCapacity) Create a new instance of this class with the specified initial capacity.
 
- 
- 
Method Details- 
add
- 
add
- 
addAll
- 
addAll
- 
set
- 
parseConvert a stream of JSONArray text into JSONArray form.- Parameters:
- is- The inputStream from which to read the JSON. It will assume the input stream is in UTF-8 and read it as such.
- Returns:
- The contructed JSONArray Object.
- Throws:
- IOEXception- Thrown if an underlying IO error from the stream occurs, or if malformed JSON is read,
- IOException
 
- 
parseConvert a stream (in reader form) of JSONArray text into object form.- Parameters:
- reader- The reader from which the JSONArray data is read.
- Returns:
- The contructed JSONArray Object.
- Throws:
- IOEXception- Thrown if an underlying IO error from the reader occurs, or if malformed JSON is read,
- IOException
 
- 
parseConvert a String of JSONArray text into object form.- Parameters:
- str- The JSONArray string to parse into a Java Object.
- Returns:
- The contructed JSONArray Object.
- Throws:
- IOEXception- Thrown if malformed JSON is read,
- IOException
 
- 
serializeConvert this object into a stream of JSON text. Same as calling serialize(os,false);- Specified by:
- serializein interface- JSONArtifact
- Parameters:
- os- The output stream to serialize data to.
- Throws:
- IOException- Thrown on IO errors during serialization.
 
- 
serializeConvert this object into a stream of JSON text. Same as calling serialize(writer,false);- Specified by:
- serializein interface- JSONArtifact
- Parameters:
- os- The output stream to serialize data to.
- verbose- Whether or not to write the JSON text in a verbose format.
- Throws:
- IOException- Thrown on IO errors during serialization.
 
- 
serializeConvert this object into a stream of JSON text. Same as calling serialize(writer,false);- Specified by:
- serializein interface- JSONArtifact
- Parameters:
- writer- The writer which to serialize the JSON text to.
- Throws:
- IOException- Thrown on IO errors during serialization.
 
- 
serializeConvert this object into a stream of JSON text, specifying verbosity.- Specified by:
- serializein interface- JSONArtifact
- Parameters:
- writer- The writer which to serialize the JSON text to.
- Throws:
- IOException- Thrown on IO errors during serialization.
 
- 
serializeConvert this object into a String of JSON text, specifying verbosity.- Specified by:
- serializein interface- JSONArtifact
- Parameters:
- verbose- Whether or not to serialize in compressed for formatted Strings.
- Throws:
- IOException- Thrown on IO errors during serialization.
 
- 
serializeConvert this object into a String of JSON text. Same as serialize(false);- Specified by:
- serializein interface- JSONArtifact
- Throws:
- IOException- Thrown on IO errors during serialization.
 
 
-