public class MatrixCursor extends AbstractCursor
Objects. Use
newRow() to add rows. Automatically expands internal capacity
as needed.| Modifier and Type | Class and Description |
|---|---|
class |
MatrixCursor.RowBuilder
Builds a row of values using either of these approaches:
Values can be added with explicit column ordering using
MatrixCursor.RowBuilder.add(Object), which starts from the left-most column and adds one
column value at a time. |
mClosed, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRowsFIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING| Constructor and Description |
|---|
MatrixCursor(String[] columnNames)
Constructs a new cursor.
|
MatrixCursor(String[] columnNames,
int initialCapacity)
Constructs a new cursor with the given initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRow(Iterable<?> columnValues)
Adds a new row to the end with the given column values.
|
void |
addRow(Object[] columnValues)
Adds a new row to the end with the given column values.
|
byte[] |
getBlob(int column)
Returns the value of the requested column as a byte array.
|
String[] |
getColumnNames()
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.
|
int |
getCount()
Returns the numbers of rows in the cursor.
|
double |
getDouble(int column)
Returns the value of the requested column as a double.
|
float |
getFloat(int column)
Returns the value of the requested column as a float.
|
int |
getInt(int column)
Returns the value of the requested column as an int.
|
long |
getLong(int column)
Returns the value of the requested column as a long.
|
short |
getShort(int column)
Returns the value of the requested column as a short.
|
String |
getString(int column)
Returns the value of the requested column as a String.
|
int |
getType(int column)
Returns data type of the given column's value.
|
boolean |
isNull(int column)
Returns
true if the value in the indicated column is null. |
MatrixCursor.RowBuilder |
newRow()
Adds a new row to the end and returns a builder for that row.
|
checkPosition, close, copyStringToBuffer, deactivate, fillWindow, finalize, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getExtras, getPosition, getUpdatedField, getWantsAllOnMoveCalls, getWindow, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, onDeactivateOrClose, onMove, registerDataSetObserver, requery, respond, setExtras, unregisterDataSetObserverpublic MatrixCursor(String[] columnNames, int initialCapacity)
columnNames - names of the columns, the ordering of which
determines column ordering elsewhere in this cursorinitialCapacity - in rowspublic MatrixCursor(String[] columnNames)
columnNames - names of the columns, the ordering of which
determines column ordering elsewhere in this cursorpublic MatrixCursor.RowBuilder newRow()
public void addRow(Object[] columnValues)
columnValues - in the same order as the the column names specified
at cursor construction timeIllegalArgumentException - if columnValues.length !=
columnNames.lengthpublic void addRow(Iterable<?> columnValues)
columnValues - in the same order as the the column names specified
at cursor construction timeIllegalArgumentException - if columnValues.size() !=
columnNames.lengthpublic int getCount()
CursorgetCount in interface CursorgetCount in class AbstractCursorpublic String[] getColumnNames()
CursorgetColumnNames in interface CursorgetColumnNames in class AbstractCursorpublic String getString(int column)
CursorThe 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.
getString in interface CursorgetString in class AbstractCursorcolumn - the zero-based index of the target column.public short getShort(int column)
CursorThe 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.
getShort in interface CursorgetShort in class AbstractCursorcolumn - the zero-based index of the target column.public int getInt(int column)
CursorThe 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.
getInt in interface CursorgetInt in class AbstractCursorcolumn - the zero-based index of the target column.public long getLong(int column)
CursorThe 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.
getLong in interface CursorgetLong in class AbstractCursorcolumn - the zero-based index of the target column.public float getFloat(int column)
CursorThe 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.
getFloat in interface CursorgetFloat in class AbstractCursorcolumn - the zero-based index of the target column.public double getDouble(int column)
CursorThe 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.
getDouble in interface CursorgetDouble in class AbstractCursorcolumn - the zero-based index of the target column.public byte[] getBlob(int column)
CursorThe 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.
getBlob in interface CursorgetBlob in class AbstractCursorcolumn - the zero-based index of the target column.public int getType(int column)
CursorCursor.getInt(int), Cursor.getFloat(int)
etc.
Returned column types are
getType in interface CursorgetType in class AbstractCursorcolumn - the zero-based index of the target column.public boolean isNull(int column)
Cursortrue if the value in the indicated column is null.isNull in interface CursorisNull in class AbstractCursorcolumn - the zero-based index of the target column.