AbstractWindowedCursor | API reference | Android Developers (original) (raw)
abstract class AbstractWindowedCursor : AbstractCursor
A base class for Cursors that store their data in [CursorWindow](/reference/kotlin/android/database/CursorWindow)
s.
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 [onMove(int,int)](/reference/kotlin/android/database/AbstractCursor#onMove%28kotlin.Int,%20kotlin.Int%29)
, allocating a new cursor window if necessary. During [requery()](/reference/kotlin/android/database/AbstractCursor#requery%28%29)
, 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.
Summary
Public constructors |
---|
AbstractWindowedCursor() |
Public methods | |
---|---|
open Unit | copyStringToBuffer(columnIndex: Int, buffer: CharArrayBuffer!) |
open ByteArray! | getBlob(columnIndex: Int) |
open Double | getDouble(columnIndex: Int) |
open Float | getFloat(columnIndex: Int) |
open Int | getInt(columnIndex: Int) |
open Long | getLong(columnIndex: Int) |
open Short | getShort(columnIndex: Int) |
open String! | getString(columnIndex: Int) |
open Int | getType(columnIndex: Int) |
open CursorWindow! | getWindow() |
open Boolean | hasWindow() Returns true if the cursor has an associated cursor window. |
open Boolean | isBlob(columnIndex: Int) |
open Boolean | isFloat(columnIndex: Int) |
open Boolean | isLong(columnIndex: Int) |
open Boolean | isNull(columnIndex: Int) |
open Boolean | isString(columnIndex: Int) |
open Unit | setWindow(window: CursorWindow!) Sets a new cursor window for the cursor to use. |
Protected methods | |
---|---|
open Unit | checkPosition() |
Properties | |
---|---|
CursorWindow! | mWindow The cursor window owned by this cursor. |
Inherited properties |
---|
From class AbstractCursor Boolean mClosed ContentResolver! mContentResolver Int mPos |
Public constructors
AbstractWindowedCursor
AbstractWindowedCursor()
Public methods
copyStringToBuffer
open fun copyStringToBuffer(
columnIndex: Int,
buffer: CharArrayBuffer!
): Unit
Parameters | |
---|---|
columnIndex | Int: the zero-based index of the target column. if the target column is null, return buffer Value is 0 or greater |
buffer | CharArrayBuffer!: the buffer to copy the text into. |
getBlob
open fun getBlob(columnIndex: Int): ByteArray!
Parameters | |
---|---|
columnIndex | Int: the zero-based index of the target column. Value is 0 or greater |
Return | |
---|---|
ByteArray! | the value of that column as a byte array. |
getDouble
open fun getDouble(columnIndex: Int): Double
Parameters | |
---|---|
columnIndex | Int: 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(columnIndex: Int): Float
Parameters | |
---|---|
columnIndex | Int: 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(columnIndex: Int): Int
Parameters | |
---|---|
columnIndex | Int: 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(columnIndex: Int): Long
Parameters | |
---|---|
columnIndex | Int: 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(columnIndex: Int): Short
Parameters | |
---|---|
columnIndex | Int: 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(columnIndex: Int): String!
Parameters | |
---|---|
columnIndex | Int: the zero-based index of the target column. Value is 0 or greater |
Return | |
---|---|
String! | the value of that column as a String. |
getWindow
open fun getWindow(): CursorWindow!
Return | |
---|---|
CursorWindow! | The pre-filled window that backs this cursor, or null if none. |
hasWindow
open fun hasWindow(): Boolean
Returns true if the cursor has an associated cursor window.
Return | |
---|---|
Boolean | True if the cursor has an associated cursor window. |
isBlob
open fun isBlob(columnIndex: Int): Boolean
Deprecated: Use #getType
isFloat
open fun isFloat(columnIndex: Int): Boolean
Deprecated: Use #getType
isLong
open fun isLong(columnIndex: Int): Boolean
Deprecated: Use #getType
isNull
open fun isNull(columnIndex: Int): Boolean
Parameters | |
---|---|
columnIndex | Int: the zero-based index of the target column. Value is 0 or greater |
Return | |
---|---|
Boolean | whether the column value is null. |
isString
open fun isString(columnIndex: Int): Boolean
Deprecated: Use #getType
setWindow
open fun setWindow(window: CursorWindow!): Unit
Sets a new cursor window for the cursor to use.
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.
Parameters | |
---|---|
window | CursorWindow!: The new cursor window, typically a remote cursor window. |
Protected methods
checkPosition
protected open fun checkPosition(): Unit
Exceptions |
---|
android.database.CursorIndexOutOfBoundsException |
Properties
mWindow
protected var mWindow: CursorWindow!
The cursor window owned by this cursor.