Added in API level 1

AbstractWindowedCursor


abstract class AbstractWindowedCursor : AbstractCursor
kotlin.Any
   ↳ android.database.AbstractCursor
   ↳ android.database.AbstractWindowedCursor

A base class for Cursors that store their data in 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 onMove(int,int), allocating a new cursor window if necessary. During 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.

Summary

Public constructors

Public methods
open Unit
copyStringToBuffer(columnIndex: Int, buffer: CharArrayBuffer!)

Retrieves the requested column text and stores it in the buffer provided.

open ByteArray!
getBlob(columnIndex: Int)

Returns the value of the requested column as a byte array.

open Double
getDouble(columnIndex: Int)

Returns the value of the requested column as a double.

open Float
getFloat(columnIndex: Int)

Returns the value of the requested column as a float.

open Int
getInt(columnIndex: Int)

Returns the value of the requested column as an int.

open Long
getLong(columnIndex: Int)

Returns the value of the requested column as a long.

open Short
getShort(columnIndex: Int)

Returns the value of the requested column as a short.

open String!
getString(columnIndex: Int)

Returns the value of the requested column as a String.

open Int
getType(columnIndex: Int)

Returns data type of the given column's value.

open CursorWindow!

If the cursor is backed by a CursorWindow, returns a pre-filled window with the contents of the cursor, otherwise null.

open Boolean

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)

Returns true if the value in the indicated column is null.

open Boolean
isString(columnIndex: Int)

open Unit

Sets a new cursor window for the cursor to use.

Protected methods
open Unit

This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds.

Inherited functions
Properties
CursorWindow!

The cursor window owned by this cursor.

Inherited properties

Public constructors

AbstractWindowedCursor

AbstractWindowedCursor()

Public methods

copyStringToBuffer

Added in API level 1
open fun copyStringToBuffer(
    columnIndex: Int,
    buffer: CharArrayBuffer!
): Unit

Retrieves the requested column text and stores it in the buffer provided. If the buffer size is not sufficient, a new char buffer will be allocated and assigned to CharArrayBuffer.data

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

Added in API level 1
open fun getBlob(columnIndex: 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 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

Added in API level 1
open fun getDouble(columnIndex: 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 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

Added in API level 1
open fun getFloat(columnIndex: 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 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

Added in API level 1
open fun getInt(columnIndex: 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 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

Added in API level 1
open fun getLong(columnIndex: 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 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

Added in API level 1
open fun getShort(columnIndex: 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 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

Added in API level 1
open fun getString(columnIndex: 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 Int: the zero-based index of the target column.
Value is 0 or greater
Return
String! the value of that column as a String.

getType

Added in API level 11
open fun getType(columnIndex: 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 Int: the zero-based index of the target column.
Value is 0 or greater
Return
Int column value type.
Value is one of the following:

getWindow

Added in API level 1
open fun getWindow(): CursorWindow!

If the cursor is backed by a CursorWindow, returns a pre-filled window with the contents of the cursor, otherwise null.

Return
CursorWindow! The pre-filled window that backs this cursor, or null if none.

hasWindow

Added in API level 1
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

Added in API level 1
Deprecated in API level 15
open fun isBlob(columnIndex: Int): Boolean

Deprecated: Use #getType

isFloat

Added in API level 5
Deprecated in API level 15
open fun isFloat(columnIndex: Int): Boolean

Deprecated: Use #getType

isLong

Added in API level 5
Deprecated in API level 15
open fun isLong(columnIndex: Int): Boolean

Deprecated: Use #getType

isNull

Added in API level 1
open fun isNull(columnIndex: Int): Boolean

Returns true if the value in the indicated column is null.

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

Added in API level 5
Deprecated in API level 15
open fun isString(columnIndex: Int): Boolean

Deprecated: Use #getType

setWindow

Added in API level 1
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

Added in API level 1
protected open fun checkPosition(): Unit

This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds. Subclass implementations of the get functions should call this before attempting to retrieve data.

Exceptions
android.database.CursorIndexOutOfBoundsException

Properties

mWindow

Added in API level 1
protected var mWindow: CursorWindow!

The cursor window owned by this cursor.