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) |
public JSONArray()
public JSONArray(int initialCapacity)
public void add(int index,
java.lang.Object element)
add in interface java.util.Listadd in class java.util.ArrayListpublic boolean add(java.lang.Object element)
add in interface java.util.Collectionadd in interface java.util.Listadd in class java.util.ArrayListpublic boolean addAll(java.util.Collection collection)
addAll in interface java.util.CollectionaddAll in interface java.util.ListaddAll in class java.util.ArrayListpublic boolean addAll(int index,
java.util.Collection collection)
addAll in interface java.util.ListaddAll in class java.util.ArrayListpublic java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listset in class java.util.ArrayListpublic 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.IOEXception - Thrown if an underlying IO error from the stream occurs, or if malformed JSON is read,java.io.IOExceptionpublic static JSONArray parse(java.io.Reader reader) throws java.io.IOException
reader - The reader from which the JSONArray data is read.IOEXception - Thrown if an underlying IO error from the reader occurs, or if malformed JSON is read,java.io.IOExceptionpublic static JSONArray parse(java.lang.String str) throws java.io.IOException
str - The JSONArray string to parse into a Java Object.IOEXception - Thrown if malformed JSON is read,java.io.IOExceptionpublic void serialize(java.io.OutputStream os)
throws java.io.IOException
serialize in interface JSONArtifactos - 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 JSONArtifactos - 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 JSONArtifactwriter - 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 JSONArtifactwriter - 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 JSONArtifactverbose - 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 JSONArtifactjava.io.IOException - Thrown on IO errors during serialization.