public class ErddapStringArray
extends java.lang.Object
This class uses "" to represent a missing value (NaN).
| Modifier and Type | Field and Description |
|---|---|
java.lang.String[] |
array
This is the main data structure.
|
protected int |
size
The number of active values (which may be different from the array's capacity).
|
| Constructor and Description |
|---|
ErddapStringArray()
A constructor for a capacity of 8 elements.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.String value)
This adds an item to the array (increasing 'size' by 1).
|
void |
ensureCapacity(long minCapacity)
This ensures that the capacity is at least 'minCapacity'.
|
static ErddapStringArray |
fromInputStream(java.io.InputStream inputStream,
java.lang.String charset)
Reads the contents of
inputStream into a StringArray. |
java.lang.String |
get(int index)
This gets a specified element.
|
int |
size()
Return the number of elements in the array.
|
protected int size
public java.lang.String[] array
public ErddapStringArray()
public static ErddapStringArray fromInputStream(java.io.InputStream inputStream, java.lang.String charset) throws java.io.IOException
inputStream into a StringArray. Each line of input will result in an element in
the array.
The specified stream remains open after this method returns.inputStream - a stream with line-based content.charset - the name of a supported charset.java.io.IOException - if an I/O error occurspublic int size()
public void add(java.lang.String value)
value - the value to be added to the arraypublic void ensureCapacity(long minCapacity)
minCapacity - the minimum acceptable capacity.
minCapacity is type long, but >= Integer.MAX_VALUE will throw exception.public java.lang.String get(int index)
index - 0 ... size-1