MatrixCursor
open class MatrixCursor : AbstractCursor
| kotlin.Any | ||
| ↳ | android.database.AbstractCursor | |
| ↳ | android.database.MatrixCursor | |
A mutable cursor implementation backed by an array of Objects. Use newRow() to add rows. Automatically expands internal capacity as needed.
Summary
| Nested classes | |
|---|---|
| open |
Builds a row of values using either of these approaches:
null.
|
| Public constructors | |
|---|---|
MatrixCursor(columnNames: Array<String!>!)Constructs a new cursor. |
|
MatrixCursor(columnNames: Array<String!>!, initialCapacity: Int)Constructs a new cursor with the given initial capacity. |
|
| Public methods | |
|---|---|
| open Unit |
addRow(columnValues: MutableIterable<*>!)Adds a new row to the end with the given column values. |
| open Unit |
Adds a new row to the end with the given column values. |
| open ByteArray! |
Returns the value of the requested column as a byte array. |
| open Array<String!>! |
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result. |
| open Int |
getCount()Returns the numbers of rows in the cursor. |
| open Double |
Returns the value of the requested column as a double. |
| open Float |
Returns the value of the requested column as a float. |
| open Int |
Returns the value of the requested column as an int. |
| open Long |
Returns the value of the requested column as a long. |
| open Short |
Returns the value of the requested column as a short. |
| open String! |
Returns the value of the requested column as a String. |
| open Int |
Returns data type of the given column's value. |
| open Boolean |
Returns |
| open MatrixCursor.RowBuilder! |
newRow()Adds a new row to the end and returns a builder for that row. |
| Inherited functions | |
|---|---|
| Inherited properties | |
|---|---|
Public constructors
MatrixCursor
MatrixCursor(columnNames: Array<String!>!)
Constructs a new cursor.
| Parameters | |
|---|---|
columnNames |
Array<String!>!: names of the columns, the ordering of which determines column ordering elsewhere in this cursor |
MatrixCursor
MatrixCursor(
columnNames: Array<String!>!,
initialCapacity: Int)
Constructs a new cursor with the given initial capacity.
| Parameters | |
|---|---|
columnNames |
Array<String!>!: names of the columns, the ordering of which determines column ordering elsewhere in this cursor |
initialCapacity |
Int: in rows |
Public methods
addRow
open fun addRow(columnValues: MutableIterable<*>!): Unit
Adds a new row to the end with the given column values. Not safe for concurrent use.
| Parameters | |
|---|---|
columnValues |
MutableIterable<*>!: in the same order as the the column names specified at cursor construction time |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if columnValues.size() != columnNames.length |
addRow
open fun addRow(columnValues: Array<Any!>!): Unit
Adds a new row to the end with the given column values. Not safe for concurrent use.
| Parameters | |
|---|---|
columnValues |
Array<Any!>!: in the same order as the the column names specified at cursor construction time |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if columnValues.length != columnNames.length |
getBlob
open fun getBlob(column: Int): ByteArray!
Returns the value of the requested column as a byte array.
The result and whether this method throws an exception when the column value is null or the column type is not a blob type is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
ByteArray! |
the value of that column as a byte array. |
getColumnNames
open fun getColumnNames(): Array<String!>!
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.
| Return | |
|---|---|
Array<String!>! |
the names of the columns returned in this query. |
getCount
open fun getCount(): Int
Returns the numbers of rows in the cursor.
| Return | |
|---|---|
Int |
the number of rows in the cursor. Value is 0 or greater |
getDouble
open fun getDouble(column: Int): Double
Returns the value of the requested column as a double.
The result and whether this method throws an exception when the column value is null, the column type is not a floating-point type, or the floating-point value is not representable as a double value is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Double |
the value of that column as a double. |
getFloat
open fun getFloat(column: Int): Float
Returns the value of the requested column as a float.
The result and whether this method throws an exception when the column value is null, the column type is not a floating-point type, or the floating-point value is not representable as a float value is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Float |
the value of that column as a float. |
getInt
open fun getInt(column: Int): Int
Returns the value of the requested column as an int.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Integer.MIN_VALUE, Integer.MAX_VALUE] is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Int |
the value of that column as an int. |
getLong
open fun getLong(column: Int): Long
Returns the value of the requested column as a long.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Long.MIN_VALUE, Long.MAX_VALUE] is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Long |
the value of that column as a long. |
getShort
open fun getShort(column: Int): Short
Returns the value of the requested column as a short.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Short.MIN_VALUE, Short.MAX_VALUE] is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Short |
the value of that column as a short. |
getString
open fun getString(column: Int): String!
Returns the value of the requested column as a String.
The result and whether this method throws an exception when the column value is null or the column type is not a string type is implementation-defined.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
String! |
the value of that column as a String. |
getType
open fun getType(column: Int): Int
Returns data type of the given column's value. The preferred type of the column is returned but the data may be converted to other types as documented in the get-type methods such as getInt(int), getFloat(int) etc.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Int |
column value type. Value is one of the following: |
isNull
open fun isNull(column: Int): Boolean
Returns true if the value in the indicated column is null.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Boolean |
whether the column value is null. |
newRow
open fun newRow(): MatrixCursor.RowBuilder!
Adds a new row to the end and returns a builder for that row. Not safe for concurrent use.
| Return | |
|---|---|
MatrixCursor.RowBuilder! |
builder which can be used to set the column values for the new row |