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()
Inherited functions
From class AbstractCursor Unit close() Unit deactivate() Unit fillWindow(position: Int, window: CursorWindow!) Unit finalize() Int getColumnCount() Int getColumnIndex(columnName: String!) Int getColumnIndexOrThrow(columnName: String!) String! getColumnName(columnIndex: Int) Array<String!>! getColumnNames() Int getCount() Bundle! getExtras() Uri! getNotificationUri() MutableList<Uri!>? getNotificationUris() Int getPosition() Any! getUpdatedField(columnIndex: Int) Boolean getWantsAllOnMoveCalls() Boolean isAfterLast() Boolean isBeforeFirst() Boolean isClosed() Boolean isFieldUpdated(columnIndex: Int) Boolean isFirst() Boolean isLast() Boolean move(offset: Int) Boolean moveToFirst() Boolean moveToLast() Boolean moveToNext() Boolean moveToPosition(position: Int) Boolean moveToPrevious() Unit onChange(selfChange: Boolean) Subclasses must call this method when they finish committing updates to notify all observers. Boolean onMove(oldPosition: Int, newPosition: Int) This function is called every time the cursor is successfully scrolled to a new position, giving the subclass a chance to update any state it may have. If it returns false the move function will also do so and the cursor will scroll to the beforeFirst position. Unit registerContentObserver(observer: ContentObserver!) Unit registerDataSetObserver(observer: DataSetObserver!) Boolean requery() Bundle! respond(extras: Bundle!) Unit setExtras(extras: Bundle!) Unit setNotificationUri(cr: ContentResolver!, notifyUri: Uri!) Specifies a content URI to watch for changes. Unit setNotificationUris(cr: ContentResolver, notifyUris: MutableList<Uri!>) Similar to setNotificationUri(android.content.ContentResolver,android.net.Uri), except this version allows to watch multiple content URIs for changes. If this is not implemented, this is equivalent to calling setNotificationUri(android.content.ContentResolver,android.net.Uri) with the first URI in uris. Calling this overrides any previous call to setNotificationUri(android.content.ContentResolver,android.net.Uri). Unit unregisterContentObserver(observer: ContentObserver!) Unit unregisterDataSetObserver(observer: DataSetObserver!)
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.