public class JSONArray extends java.util.ArrayList implements JSONArtifact
Constructor and Description |
---|
JSONArray()
Create a new instance of this class.
|
JSONArray(int initialCapacity)
Create a new instance of this class with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Object element) |
boolean |
add(java.lang.Object element) |
boolean |
addAll(java.util.Collection collection) |
boolean |
addAll(int index,
java.util.Collection collection) |
static JSONArray |
parse(java.io.InputStream is)
Convert a stream of JSONArray text into JSONArray form.
|
static JSONArray |
parse(java.io.Reader reader)
Convert a stream (in reader form) of JSONArray text into object form.
|
static JSONArray |
parse(java.lang.String str)
Convert a String of JSONArray text into object form.
|
java.lang.String |
serialize()
Convert this object into a String of JSON text.
|
java.lang.String |
serialize(boolean verbose)
Convert this object into a String of JSON text, specifying verbosity.
|
void |
serialize(java.io.OutputStream os)
Convert this object into a stream of JSON text.
|
void |
serialize(java.io.OutputStream os,
boolean verbose)
Convert this object into a stream of JSON text.
|
void |
serialize(java.io.Writer writer)
Convert this object into a stream of JSON text.
|
void |
serialize(java.io.Writer writer,
boolean verbose)
Convert this object into a stream of JSON text, specifying verbosity.
|
java.lang.Object |
set(int index,
java.lang.Object element) |
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
public JSONArray()
public JSONArray(int initialCapacity)
public void add(int index, java.lang.Object element)
add
in interface java.util.List
add
in class java.util.ArrayList
public boolean add(java.lang.Object element)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.ArrayList
public boolean addAll(java.util.Collection collection)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.ArrayList
public boolean addAll(int index, java.util.Collection collection)
addAll
in interface java.util.List
addAll
in class java.util.ArrayList
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.ArrayList
public static JSONArray parse(java.io.InputStream is) throws java.io.IOException
is
- The inputStream from which to read the JSON. It will assume the input stream is in UTF-8 and read it
as such.java.io.IOException
- Thrown if an underlying IO error from the stream occurs, or if malformed JSON is read,public static JSONArray parse(java.io.Reader reader) throws java.io.IOException
reader
- The reader from which the JSONArray data is read.java.io.IOException
- Thrown if an underlying IO error from the reader occurs, or if malformed JSON is read,public static JSONArray parse(java.lang.String str) throws java.io.IOException
str
- The JSONArray string to parse into a Java Object.java.io.IOException
- Thrown if malformed JSON is read,public void serialize(java.io.OutputStream os) throws java.io.IOException
serialize
in interface JSONArtifact
os
- The output stream to serialize data to.java.io.IOException
- Thrown on IO errors during serialization.public void serialize(java.io.OutputStream os, boolean verbose) throws java.io.IOException
serialize
in interface JSONArtifact
os
- The output stream to serialize data to.verbose
- Whether or not to write the JSON text in a verbose format.java.io.IOException
- Thrown on IO errors during serialization.public void serialize(java.io.Writer writer) throws java.io.IOException
serialize
in interface JSONArtifact
writer
- The writer which to serialize the JSON text to.java.io.IOException
- Thrown on IO errors during serialization.public void serialize(java.io.Writer writer, boolean verbose) throws java.io.IOException
serialize
in interface JSONArtifact
writer
- The writer which to serialize the JSON text to.java.io.IOException
- Thrown on IO errors during serialization.public java.lang.String serialize(boolean verbose) throws java.io.IOException
serialize
in interface JSONArtifact
verbose
- Whether or not to serialize in compressed for formatted Strings.java.io.IOException
- Thrown on IO errors during serialization.public java.lang.String serialize() throws java.io.IOException
serialize
in interface JSONArtifact
java.io.IOException
- Thrown on IO errors during serialization.