com.intersystems.jdbc

## Class IRISList

- java.lang.Object
- - com.intersystems.jdbc.IRISList

    public class IRISList
    extends Object

IRISList - $LIST projection. Includes a number of methods allowing manipulation of $LIST structure in Java.

### Constructor Summary

Constructors
Constructor and Description
`IRISList()` Create an empty IRISList.
`IRISList(boolean enableCompactDouble)` Create an empty IRISList using the given compact double flag.
`IRISList(byte[] buffer)` Create an IRISList from the provided buffer with the default character set name.
`IRISList(byte[] buffer, int length)` Create an IRISList from the provided buffer with the default character set name.
`IRISList(byte[] buffer, int length, String charSet)` Create an IRISList from the provided buffer with default character set name.
`IRISList(byte[] buffer, int length, String charSet, boolean enableCompactDouble)` Create an IRISList from the provided buffer with provided character set name and compact double flag.
`IRISList(byte[] buffer, String charSet)` Create an IRISList from the provided buffer with provided character set name.
`IRISList(IRISList list)` Create a copy of the provided list.
`IRISList(String charSet, boolean enableCompactDouble)` Create an empty IRISList using the given character set name and compact double flag.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `add(BigDecimal value)` Append BigDecimal value to the end of the list.
`void` `add(BigInteger value)` Append BigInteger value to the end of the list.
`void` `add(boolean value)` Append boolean value to the end of the list.
`void` `add(Boolean value)` Append Boolean value to the end of the list.
`void` `add(byte[] value)` Append byte[] to the the end of the list.
`void` `add(byte[] value, int length)` Append first lenght bytes from byte[] to the the end of the list.
`void` `add(Collection collection)` Appends all of the elements in the specified collection to the end of this list, in same order that they are returned by the specified collection's iterator.
`void` `add(double value)` Append double value to the end of the list.
`void` `add(Double value)` Append Double value to the end of the list.
`void` `add(float value)` Append float value to the end of the list.
`void` `add(Float value)` Append Float value to the end of the list.
`void` `add(int value)` Append int value to the end of the list.
`void` `add(Integer value)` Append Integer value to the end of the list.
`void` `add(IRISList list)` Append IRISList value to the end of the list.
`void` `add(long value)` Append long value to the end of the list.
`void` `add(Long value)` Append Long value to the end of the list.
`void` `add(Object value)` Append value to the end of the list.
`void` `add(Object[] array)` Appends all of the elements in the specified array to the end of this list.
`void` `add(short value)` Append short value to the end of the list.
`void` `add(Short value)` Append Short value to the end of the list.
`void` `add(String value)` Append String value to the end of the list.
`void` `addEmpty()` Append empty to end of the list.
`void` `addNull()` Append null to end of the list.
`void` `clear()` Resets the list by removing all elements from the list.
`IRISList` `concat(IRISList list)` Create a new IRISList by appending specified list to the end of this IRISList.
`int` `count()` Return number of elements in the list.
`static int` `DateToHorolog(Date value, Calendar calendar)` Convert Date to Horolog.
`boolean` `equals(Object list)` Compares the specified list with this list for equality.
`Object` `get(int index)` Get element at given index as an Object.
`BigDecimal` `getBigDecimal(int index)` Returns the $list item in the buffer at index, index set to next element.
`BigInteger` `getBigInteger(int index)` Returns the $list item in the buffer at index, index set to next element.
`Boolean` `getBoolean(int index)` Get element at given index as Boolean.
`byte[]` `getBuffer()`
`byte[]` `getBytes(int index)` Returns copy of byte array value of element at index.
`String` `getCharSet()` get IRISList Charset Name, dafault null
`Double` `getDouble(int index)` Returns the $list item in the buffer at index, index set to next element
`Float` `getFloat(int index)` Returns the $list item in the buffer at index, index set to next element
`Integer` `getInteger(int index)` Returns the $list item in the buffer at index, index set to next element.
`IRISList` `getList(int index)` Get current element at given index as IRISList.
`Long` `getLong(int index)` Returns the $list item in the buffer at index, index set to next element.
`Short` `getShort(int index)` Returns the $list item in the buffer at index, index set to next element.
`String` `getString(int index)` Returns the $list item in the buffer at index, index set to next element.
`int` `hashCode()`
`static Date` `HorologToDate(int HorologValue, Calendar calendar)` Convert Horolog to Date.
`static Time` `HorologToTime(int HorologValue, Calendar calendar)` Convert Horolog to Time.
`boolean` `isCompactDoubleEnabled()` Checks whether `double` and `float` values will be written in compact form.
`static Timestamp` `PosixToTimestamp(long PosixValue, Calendar calendar)` Convert long to Timestamp.
`boolean` `remove(int index)` Remove element at index from the list.
`void` `set(int index, Object value)` Set or update the given element with an value.
`void` `set(int index, Object[] value)` Set or update the given elements.
`void` `setCharSet(String charSet)` set IRISList Charset Name
`void` `setCompactDoubleEnabled(boolean value)` Enables or disables writing `double` and `float` values to this list in compact form.
`int` `size()` Return the size of the list - number of bytes used by IRISlist
`IRISList` `subList(int from, int to)` Return a new IRISList that is obtained by getting all the elements of this list starting at from index, and ending at to index.
`static long` `TimestampToPosix(Timestamp Value, Calendar calendar)` Convert Timetsamp to Posix.
`static int` `TimeToHorolog(Time value, Calendar calendar)` Convert Time to Horolog.
`Object[]` `toArray()` Returns an array of Objects containing all of the elements in this list.
`ArrayList<Object>` `toList()` Returns a java.util.List containing all of the elements in this list.
`String` `toString()` Returns the visual representation of buffer as $list.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### IRISList

    public IRISList()

Create an empty IRISList.

#### IRISList

    public IRISList(boolean enableCompactDouble)

Create an empty IRISList using the given compact double flag.

Parameters:
  `enableCompactDouble` - if `true` write `double` and `float` values in compact form.

#### IRISList

    public IRISList(String charSet,
                    boolean enableCompactDouble)

Create an empty IRISList using the given character set name and compact double flag.

Parameters:
  `charSet` - character set name
  `enableCompactDouble` - if `true` write `double` and `float` values in compact form.

#### IRISList

    public IRISList(IRISList list)

Create a copy of the provided list.

Parameters:
  `list` - IRISList to copy

#### IRISList

    public IRISList(byte[] buffer,
                    int length)

Create an IRISList from the provided buffer with the default character set name. The buffer will be used by the IRISList; it is not copied.

Parameters:
  `buffer` - buffer to be allocated
  `length` - initial buffer size to be allocated

#### IRISList

    public IRISList(byte[] buffer)

Create an IRISList from the provided buffer with the default character set name. The buffer will be used by the IRISList; it is not copied.

Parameters:
  `buffer` - buffer to be allocated

#### IRISList

    public IRISList(byte[] buffer,
                    int length,
                    String charSet)

Create an IRISList from the provided buffer with default character set name. The buffer will be used by the IRISList; it is not copied.

Parameters:
  `buffer` - buffer to be allocated
  `length` - initial buffer size to be allocated
  `charSet` - character set name

#### IRISList

    public IRISList(byte[] buffer,
                    String charSet)

Create an IRISList from the provided buffer with provided character set name. The buffer will be used by the IRISList; it is not copied.

Parameters:
  `buffer` - buffer to be allocated
  `charSet` - character set name

#### IRISList

    public IRISList(byte[] buffer,
                    int length,
                    String charSet,
                    boolean enableCompactDouble)

Create an IRISList from the provided buffer with provided character set name and compact double flag. The buffer will be used by the IRISList; it is not copied.

Parameters:
  `buffer` - buffer to be allocated
  `length` - initial buffer size to be allocated
  `charSet` - character set name
  `enableCompactDouble` - if `true` write `double` and `float` values in compact form.

### Method Detail

#### getCharSet

    public String getCharSet()

get IRISList Charset Name, dafault null

Returns:
  the name of the Charset

#### setCharSet

    public void setCharSet(String charSet)

set IRISList Charset Name

Parameters:
  `charSet` - Charset Name

#### isCompactDoubleEnabled

    public boolean isCompactDoubleEnabled()

Checks whether `double` and `float` values will be written in compact form.

Returns:
  `true` if compaction is enabled; `false` otherwise.

#### setCompactDoubleEnabled

    public void setCompactDoubleEnabled(boolean value)

Enables or disables writing `double` and `float` values to this list in compact form.

Parameters:
  `value` - `true` to enable creating `double` and `float` values in compact form; `false` otherwise.

#### get

    public Object get(int index)

Get element at given index as an Object. type of object reflect internal list presentation - byte[], String, int, long, BigDecimal, Float, Double

Parameters:
  `index` - index
Returns:
  Object
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (less then 1 or pass the end of the list)

#### getBoolean

    public Boolean getBoolean(int index)

Get element at given index as Boolean.

Parameters:
  `index` - index
Returns:
  Boolean
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getDouble

    public Double getDouble(int index)

Returns the $list item in the buffer at index, index set to next element

Parameters:
  `index` - index
Returns:
  Double
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getFloat

    public Float getFloat(int index)

Returns the $list item in the buffer at index, index set to next element

Parameters:
  `index` - index
Returns:
  Float
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getInteger

    public Integer getInteger(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  Integer
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getLong

    public Long getLong(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  Long
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getShort

    public Short getShort(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  Short
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getBigInteger

    public BigInteger getBigInteger(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  BigInteger
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getBigDecimal

    public BigDecimal getBigDecimal(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  BigDecimal
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getString

    public String getString(int index)

Returns the $list item in the buffer at index, index set to next element.

Parameters:
  `index` - index
Returns:
  String
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (negative or greater than size())

#### getBytes

    public byte[] getBytes(int index)

Returns copy of byte array value of element at index. New array will be allocated.

Parameters:
  `index` - index
Returns:
  byte[]

#### getList

    public IRISList getList(int index)

Get current element at given index as IRISList.

Parameters:
  `index` - index to list element
Returns:
  IRISList
Throws:
  `IndexOutOfBoundsException` - if the index is out of range (less then 1 or pass the end of the list)

#### addNull

    public void addNull()

Append null to end of the list.

#### addEmpty

    public void addEmpty()

Append empty to end of the list.

#### add

    public void add(int value)

Append int value to the end of the list.

Parameters:
  `value` - int value

#### add

    public void add(Integer value)

Append Integer value to the end of the list.

Parameters:
  `value` - Integer value

#### add

    public void add(short value)

Append short value to the end of the list.

Parameters:
  `value` - short value

#### add

    public void add(Short value)

Append Short value to the end of the list.

Parameters:
  `value` - Short value

#### add

    public void add(String value)

Append String value to the end of the list.

Parameters:
  `value` - String value

#### add

    public void add(long value)

Append long value to the end of the list.

Parameters:
  `value` - long value

#### add

    public void add(Long value)

Append Long value to the end of the list.

Parameters:
  `value` - Long value

#### add

    public void add(double value)

Append double value to the end of the list.

Parameters:
  `value` - double value

#### add

    public void add(Double value)

Append Double value to the end of the list.

Parameters:
  `value` - Double value

#### add

    public void add(float value)

Append float value to the end of the list.

Parameters:
  `value` - float value

#### add

    public void add(Float value)

Append Float value to the end of the list.

Parameters:
  `value` - Float value

#### add

    public void add(byte[] value)

Append byte[] to the the end of the list.

Parameters:
  `value` - byte[] value

#### add

    public void add(byte[] value,
                    int length)

Append first lenght bytes from byte[] to the the end of the list.

Parameters:
  `value` - byte[] value
  `length` - number of bytes to be added

#### add

    public void add(IRISList list)

Append IRISList value to the end of the list.

Parameters:
  `list` - IRISList value
Throws:
  `IllegalArgumentException` - if `isCompactDoubleEnabled()` is `false` for this list, but is `true` for the list to be added.

#### add

    public void add(boolean value)

Append boolean value to the end of the list.

Parameters:
  `value` - boolean value

#### add

    public void add(Boolean value)

Append Boolean value to the end of the list.

Parameters:
  `value` - Boolean value

#### add

    public void add(BigInteger value)

Append BigInteger value to the end of the list.

Parameters:
  `value` - BigInteger value

#### add

    public void add(BigDecimal value)

Append BigDecimal value to the end of the list.

Parameters:
  `value` - BigDecimal value

#### add

    public void add(Object value)

Append value to the end of the list. Objects are restricted to the following types: Integer, Short, Long, Boolean, BigInteger, BigDecimal, Float, Double, String, char[], byte[], IRISList, other types will generate Type out of range exception

Parameters:
  `value` - Object value

#### add

    public void add(Object[] array)

Appends all of the elements in the specified array to the end of this list. Objects can be of the following types only Integer, Short, Long, Boolean, BigInteger, BigDecimal, Float, Double, String, char[], byte[], IRISList.

Parameters:
  `array` - object array to be appended

#### add

    public void add(Collection collection)

Appends all of the elements in the specified collection to the end of this list, in same order that they are returned by the specified collection's iterator. Objects in the collection can be of the following types only Integer, Short, Long, Boolean, BigInteger, BigDecimal, Float, Double, String, char[], byte[], IRISList.

Parameters:
  `collection` - collection

#### set

    public void set(int index,
                    Object value)

Set or update the given element with an value. If the given element exists, it will be updated to the new value. If it does not exist (is beyond the end of the list), the value at the given index will be set to the value provided, padding the list (with nulls) up to that position. Objects to be added are restricted to the following types: Integer, Short, Long, Boolean, BigInteger, BigDecimal, Float, Double, String, byte[], char[],IRISList.

Parameters:
  `index` - index
  `value` - Object value
Throws:
  `IndexOutOfBoundsException` - if the index is less than 1

#### set

    public void set(int index,
                    Object[] value)

Set or update the given elements. If the given element exists, it will be replaced and subsequent elements will be shifted to accommodate all the elements that are being added. If it does not exist (is beyond the end of the list), the value at the given index will be set to the value provided, padding the list (with nulls) up to that position. Objects to be added are restricted to the following types: Integer, Short, Long, Boolean, BigInteger, BigDecimal, Float, Double, String, byte[], char[],IRISList.

Parameters:
  `index` - index
  `value` - Object value
Throws:
  `IndexOutOfBoundsException` - if the index is less than 1

#### size

    public int size()

Return the size of the list - number of bytes used by IRISlist

Returns:
  list size

#### count

    public int count()

Return number of elements in the list.

Returns:
  number of elements in the list

#### clear

    public void clear()

Resets the list by removing all elements from the list.

#### remove

    public boolean remove(int index)

Remove element at index from the list. Returns true if an element at the given index existed and was removed, false otherwise. Important note: this is a expensive method as the list will most likely have to be reallocated.

Parameters:
  `index` - index
Returns:
  true if element at index existed

#### subList

    public IRISList subList(int from,
                            int to)

Return a new IRISList that is obtained by getting all the elements of this list starting at from index, and ending at to index.

Parameters:
  `from` - from index
  `to` - to index
Returns:
  IRISList
Throws:
  `IndexOutOfBoundsException` - - for an illegal index value (from is greater than count(), to less than from)

#### toArray

    public Object[] toArray()

Returns an array of Objects containing all of the elements in this list.

Returns:
  an array of Objects corresponding to this list

#### concat

    public IRISList concat(IRISList list)

Create a new IRISList by appending specified list to the end of this IRISList.

Parameters:
  `list` - IRISList to be added
Returns:
  a new IRISList containing the result of the concatenation
Throws:
  `IllegalArgumentException` - if `isCompactDoubleEnabled()` is `false` for this list, but is `true` for the list to be appended.

#### toList

    public ArrayList<Object> toList()

Returns a java.util.List containing all of the elements in this list.

Returns:
  a java.util.List corresponding to this $LIST

#### equals

    public boolean equals(Object list)

Compares the specified list with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order.

Overrides:
  `equals` in class `Object`
Parameters:
  `list` - list to compare to
Returns:
  true if lists are equal

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### PosixToTimestamp

    public static Timestamp PosixToTimestamp(long PosixValue,
                                             Calendar calendar)

Convert long to Timestamp.

Parameters:
  `PosixValue` - long
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  Timestamp

#### TimestampToPosix

    public static long TimestampToPosix(Timestamp Value,
                                        Calendar calendar)

Convert Timetsamp to Posix.

Parameters:
  `Value` - Timestamp
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  long

#### HorologToDate

    public static Date HorologToDate(int HorologValue,
                                     Calendar calendar)

Convert Horolog to Date.

Parameters:
  `HorologValue` - int
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  Date

#### DateToHorolog

    public static int DateToHorolog(Date value,
                                    Calendar calendar)

Convert Date to Horolog.

Parameters:
  `value` - Date
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  int

#### HorologToTime

    public static Time HorologToTime(int HorologValue,
                                     Calendar calendar)

Convert Horolog to Time.

Parameters:
  `HorologValue` - int
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  Time

#### TimeToHorolog

    public static int TimeToHorolog(Time value,
                                    Calendar calendar)

Convert Time to Horolog.

Parameters:
  `value` - Time
  `calendar` - Calendar, used to determine GMT and DST offsets. Can be null for default calendar
Returns:
  int

#### toString

    public String toString()

Returns the visual representation of buffer as $list.

Overrides:
  `toString` in class `Object`
Returns:
  visual representation of buffer as $list

#### getBuffer

    public byte[] getBuffer()