public class JSONArray extends ArrayList<Object> implements JSONArtifact
modCount| Constructor and Description |
|---|
JSONArray()
Constructor
|
JSONArray(int intialCapacity)
Constructor with initial capacity allocated
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object element) |
boolean |
add(Object element) |
boolean |
addAll(Collection<?> collection) |
boolean |
addAll(int index,
Collection<?> collection) |
static JSONArray |
parse(InputStream is)
Parses the supplied input stream to derive a
JSONArray |
static JSONArray |
parse(Reader reader)
Parses the supplied reader to derive a
JSONArray |
static JSONArray |
parse(String input)
Parses the supplied String to derive a
JSONArray |
String |
serialize()
Convert this object into a String of JSON text.
|
String |
serialize(boolean verbose) |
void |
serialize(OutputStream os)
Convert this object into a stream of JSON text.
|
void |
serialize(OutputStream os,
boolean verbose)
Convert this object into a stream of JSON text.
|
void |
serialize(Writer writer)
Convert this object into a stream of JSON text.
|
void |
serialize(Writer writer,
boolean verbose)
Convert this object into a stream of JSON text, specifying verbosity.
|
Object |
set(int index,
Object element) |
String |
toString() |
String |
toString(StringBuffer sb,
int indent,
int incr)
Abstract method to help with recursive formatting of JSON into a String
|
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, trimToSizeequals, hashCodecontainsAllfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic JSONArray()
public JSONArray(int intialCapacity)
intialCapacity - initial size for the arraypublic static JSONArray parse(InputStream is) throws IOException
JSONArrayis - The input stream to be parsedJSONArray associated with the input stream.IOException - If a parsing error occurs.public static JSONArray parse(Reader reader) throws IOException
JSONArrayreader - The Reader to be parsedJSONArray associated with the input reader.IOException - If a parsing error occurs.public static JSONArray parse(String input) throws IOException
JSONArrayinput - The String to be parsedJSONArray associated with the input String.IOException - If a parsing error occurs.public void add(int index,
Object element)
public boolean add(Object element)
public boolean addAll(Collection<?> collection)
public boolean addAll(int index,
Collection<?> collection)
public String serialize() throws IOException
JSONArtifactserialize in interface JSONArtifactIOException - Thrown on IO errors during serialization.public String serialize(boolean verbose) throws IOException
serialize in interface JSONArtifactverbose - Whether or not to write the JSON text in a verbose format.IOException - Thrown on IO errors during serialization.public void serialize(OutputStream os) throws IOException
JSONArtifactserialize in interface JSONArtifactos - The output stream to serialize data to.IOException - Thrown on IO errors during serialization.public void serialize(OutputStream os, boolean verbose) throws IOException
JSONArtifactserialize in interface JSONArtifactos - The output stream to serialize data to.verbose - Whether or not to write the JSON text in a verbose format.IOException - Thrown on IO errors during serialization.public void serialize(Writer writer) throws IOException
JSONArtifactserialize in interface JSONArtifactwriter - The writer which to serialize the JSON text to.IOException - Thrown on IO errors during serialization.public void serialize(Writer writer, boolean verbose) throws IOException
JSONArtifactserialize in interface JSONArtifactwriter - The writer which to serialize the JSON text to.verbose - Whether or not to write the JSON text in a verbose format.IOException - Thrown on IO errors during serialization.public String toString()
toString in class AbstractCollection<Object>public String toString(StringBuffer sb, int indent, int incr)
JSONArtifacttoString in interface JSONArtifactsb - Buffer to receive formatted JSON contentindent - The amount of indentation expected in the formatted output.incr - the amount of incremental spacing used for formatted output.Copyright © 2020. All rights reserved.