public abstract class AbstractWindowedCursor extends AbstractCursor
CursorWindows.
The cursor owns the cursor window it uses. When the cursor is closed, its window is also closed. Likewise, when the window used by the cursor is changed, its old window is closed. This policy of strict ownership ensures that cursor windows are not leaked.
Subclasses are responsible for filling the cursor window with data during
AbstractCursor.onMove(int, int), allocating a new cursor window if necessary.
During AbstractCursor.requery(), the existing cursor window should be cleared and
filled with new data.
If the contents of the cursor change or become invalid, the old window must be closed (because it is owned by the cursor) and set to null.
| Modifier and Type | Field and Description |
|---|---|
protected CursorWindow |
mWindow
The cursor window owned by this cursor.
|
mClosed, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRowsFIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING| Constructor and Description |
|---|
AbstractWindowedCursor() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkPosition()
This function throws CursorIndexOutOfBoundsException if
the cursor position is out of bounds.
|
protected void |
clearOrCreateWindow(String name)
If there is a window, clear it.
|
protected void |
closeWindow()
Closes the cursor window and sets
mWindow to null. |
void |
copyStringToBuffer(int columnIndex,
CharArrayBuffer buffer)
Retrieves the requested column text and stores it in the buffer provided.
|
byte[] |
getBlob(int columnIndex)
Returns the value of the requested column as a byte array.
|
double |
getDouble(int columnIndex)
Returns the value of the requested column as a double.
|
float |
getFloat(int columnIndex)
Returns the value of the requested column as a float.
|
int |
getInt(int columnIndex)
Returns the value of the requested column as an int.
|
long |
getLong(int columnIndex)
Returns the value of the requested column as a long.
|
short |
getShort(int columnIndex)
Returns the value of the requested column as a short.
|
String |
getString(int columnIndex)
Returns the value of the requested column as a String.
|
int |
getType(int columnIndex)
Returns data type of the given column's value.
|
CursorWindow |
getWindow()
If the cursor is backed by a
CursorWindow, returns a pre-filled
window with the contents of the cursor, otherwise null. |
boolean |
hasWindow()
Returns true if the cursor has an associated cursor window.
|
boolean |
isBlob(int columnIndex)
Deprecated.
Use
getType(int) |
boolean |
isFloat(int columnIndex)
Deprecated.
Use
getType(int) |
boolean |
isLong(int columnIndex)
Deprecated.
Use
getType(int) |
boolean |
isNull(int columnIndex)
Returns
true if the value in the indicated column is null. |
boolean |
isString(int columnIndex)
Deprecated.
Use
getType(int) |
protected void |
onDeactivateOrClose() |
void |
setWindow(CursorWindow window)
Sets a new cursor window for the cursor to use.
|
close, deactivate, fillWindow, finalize, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getExtras, getPosition, getUpdatedField, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, onMove, registerDataSetObserver, requery, respond, setExtras, unregisterDataSetObserverprotected CursorWindow mWindow
public byte[] getBlob(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public String getString(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public void copyStringToBuffer(int columnIndex,
CharArrayBuffer buffer)
CursorcopyStringToBuffer in interface CursorcopyStringToBuffer in class AbstractCursorcolumnIndex - the zero-based index of the target column.
if the target column is null, return bufferbuffer - the buffer to copy the text into.public short getShort(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public int getInt(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public long getLong(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public float getFloat(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public double getDouble(int columnIndex)
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 AbstractCursorcolumnIndex - the zero-based index of the target column.public boolean isNull(int columnIndex)
Cursortrue if the value in the indicated column is null.isNull in interface CursorisNull in class AbstractCursorcolumnIndex - the zero-based index of the target column.@Deprecated public boolean isBlob(int columnIndex)
getType(int)@Deprecated public boolean isString(int columnIndex)
getType(int)@Deprecated public boolean isLong(int columnIndex)
getType(int)@Deprecated public boolean isFloat(int columnIndex)
getType(int)public int getType(int columnIndex)
CursorCursor.getInt(int), Cursor.getFloat(int)
etc.
Returned column types are
getType in interface CursorgetType in class AbstractCursorcolumnIndex - the zero-based index of the target column.protected void checkPosition()
AbstractCursorcheckPosition in class AbstractCursorpublic CursorWindow getWindow()
AbstractCursorCursorWindow, returns a pre-filled
window with the contents of the cursor, otherwise null.getWindow in interface CrossProcessCursorgetWindow in class AbstractCursorpublic void setWindow(CursorWindow window)
The cursor takes ownership of the provided cursor window; the cursor window will be closed when the cursor is closed or when the cursor adopts a new cursor window.
If the cursor previously had a cursor window, then it is closed when the new cursor window is assigned.
window - The new cursor window, typically a remote cursor window.public boolean hasWindow()
protected void closeWindow()
mWindow to null.protected void clearOrCreateWindow(String name)
name - The window name.protected void onDeactivateOrClose()
onDeactivateOrClose in class AbstractCursor