Most visited

Recently visited

Added in API level 1

AbstractWindowedCursor

public abstract class AbstractWindowedCursor
extends AbstractCursor

java.lang.Object
    android.database.AbstractCursor
      android.database.AbstractWindowedCursor
Known Direct Subclasses


光标的基类,它们将数据存储在 CursorWindow

游标拥有它使用的光标窗口。 当光标关闭时,其窗口也被关闭。 同样,当光标使用的窗口改变时,其旧窗口关闭。 这种严格的所有权政策确保光标窗口不会泄露。

子类负责在onMove(int, int)期间用数据填充游标窗口,如有必要则分配新的游标窗口。 requery()期间,应该清除现有的光标窗口并填入新数据。

如果光标的内容改变或变为无效,则必须关闭旧窗口(因为它由光标拥有)并设置为空。

摘要(Summary)

Inherited constants

From interface android.database.Cursor

Fields

protected CursorWindow mWindow

该游标拥有的游标窗口。

Inherited fields

From class android.database.AbstractCursor

Public constructors

AbstractWindowedCursor()

公共方法(Public methods)

void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)

检索请求的列文本并将其存储在提供的缓冲区中。

byte[] getBlob(int columnIndex)

以字节数组的形式返回请求的列的值。

double getDouble(int columnIndex)

以double形式返回请求的列的值。

float getFloat(int columnIndex)

以浮点形式返回请求的列的值。

int getInt(int columnIndex)

以int形式返回请求的列的值。

long getLong(int columnIndex)

以long形式返回请求列的值。

short getShort(int columnIndex)

以短为单位返回请求列的值。

String getString(int columnIndex)

以String形式返回请求的列的值。

int getType(int columnIndex)

返回给定列值的数据类型。

CursorWindow getWindow()

如果游标由 CursorWindow支持,则返回一个预填充窗口,其中包含游标的内容,否则返回null。

boolean hasWindow()

如果光标有关联的光标窗口,则返回true。

boolean isBlob(int columnIndex)

此方法在API级别11中已弃用。使用getType(int)

boolean isFloat(int columnIndex)

此方法在API级别11中已弃用。请使用getType(int)

boolean isLong(int columnIndex)

此方法在API级别11中已弃用。请使用getType(int)

boolean isNull(int columnIndex)

如果指定列中的值为空,则返回 true

boolean isString(int columnIndex)

此方法在API级别11中已弃用。请使用getType(int)

void setWindow(CursorWindow window)

设置一个新的光标窗口供光标使用。

Protected methods

void checkPosition()

如果光标位置超出范围,则此函数将引发CursorIndexOutOfBoundsException。

继承方法(Inherited methods)

From class android.database.AbstractCursor
From class java.lang.Object
From interface android.database.CrossProcessCursor
From interface android.database.Cursor
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Fields

mWindow

Added in API level 1
CursorWindow mWindow

该游标拥有的游标窗口。

Public constructors

AbstractWindowedCursor

Added in API level 1
AbstractWindowedCursor ()

公共方法(Public methods)

copyStringToBuffer

Added in API level 1
void copyStringToBuffer (int columnIndex, 
                CharArrayBuffer buffer)

检索请求的列文本并将其存储在提供的缓冲区中。 如果缓冲区大小不够,将分配一个新的字符缓冲区并分配给CharArrayBuffer.data

参数(Parameters)
columnIndex int: the zero-based index of the target column. if the target column is null, return buffer
buffer CharArrayBuffer: the buffer to copy the text into.

getBlob

Added in API level 1
byte[] getBlob (int columnIndex)

以字节数组的形式返回请求的列的值。

结果以及当列值为空或列类型不是blob类型时此方法是否引发异常是实现定义的。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
byte[] the value of that column as a byte array.

getDouble

Added in API level 1
double getDouble (int columnIndex)

以double形式返回请求的列的值。

结果以及当列值为空,列类型不是浮点类型或浮点值不可表示时,此方法是否引发异常,或者由于实现定义的值为 double ,所以浮点值不可表示。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
double the value of that column as a double.

getFloat

Added in API level 1
float getFloat (int columnIndex)

以浮点形式返回请求的列的值。

结果以及当列值为空,列类型不是浮点类型或浮点值不可表示时,此方法引发异常,或者由于实现定义了 float值,因此浮点值不可表示。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
float the value of that column as a float.

getInt

Added in API level 1
int getInt (int columnIndex)

以int形式返回请求的列的值。

结果,这种方法是否抛出异常当列值为空,列类型是不是一个整数类型,或者整数值是范围[外 Integer.MIN_VALUEInteger.MAX_VALUE ]为实现定义的。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
int the value of that column as an int.

getLong

Added in API level 1
long getLong (int columnIndex)

以long形式返回请求列的值。

结果,这种方法是否抛出异常当列值为空,列类型是不是一个整数类型,或者整数值是范围[外 Long.MIN_VALUELong.MAX_VALUE ]为实现定义的。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
long the value of that column as a long.

getShort

Added in API level 1
short getShort (int columnIndex)

以短为单位返回请求列的值。

结果,这种方法是否抛出异常当列值为空,列类型是不是一个整数类型,或者整数值是范围[外 Short.MIN_VALUEShort.MAX_VALUE ]为实现定义的。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
short the value of that column as a short.

getString

Added in API level 1
String getString (int columnIndex)

以String形式返回请求的列的值。

结果以及此方法在列值为空或列类型不是字符串类型时是否引发异常是实现定义的。

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
String the value of that column as a String.

getType

Added in API level 11
int getType (int columnIndex)

返回给定列值的数据类型。 返回列的首选类型,但数据可能会转换为其他类型,如获取类型方法(如getFloat(int)等)中getInt(int) getFloat(int)

返回的列类型是

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
int column value type

getWindow

Added in API level 1
CursorWindow getWindow ()

如果游标由 CursorWindow支持,则返回一个预填充窗口,其中包含游标的内容,否则返回null。

返回(Returns)
CursorWindow The pre-filled window that backs this cursor, or null if none.

hasWindow

Added in API level 1
boolean hasWindow ()

如果光标有关联的光标窗口,则返回true。

返回(Returns)
boolean True if the cursor has an associated cursor window.

isBlob

Added in API level 1
boolean isBlob (int columnIndex)

此方法在API级别11中已弃用。
使用getType(int)

参数(Parameters)
columnIndex int
返回(Returns)
boolean

isFloat

Added in API level 5
boolean isFloat (int columnIndex)

此方法在API级别11中已弃用。
使用getType(int)

参数(Parameters)
columnIndex int
返回(Returns)
boolean

isLong

Added in API level 5
boolean isLong (int columnIndex)

此方法在API级别11中已弃用。
使用getType(int)

参数(Parameters)
columnIndex int
返回(Returns)
boolean

isNull

Added in API level 1
boolean isNull (int columnIndex)

如果指定列中的值为空,则返回 true

参数(Parameters)
columnIndex int: the zero-based index of the target column.
返回(Returns)
boolean whether the column value is null.

isString

Added in API level 5
boolean isString (int columnIndex)

此方法在API级别11中已弃用。
使用getType(int)

参数(Parameters)
columnIndex int
返回(Returns)
boolean

setWindow

Added in API level 1
void setWindow (CursorWindow window)

设置一个新的光标窗口供光标使用。

游标取得所提供的光标窗口的所有权; 当光标关闭或光标采用新的光标窗口时,光标窗口将会关闭。

如果光标先前有一个光标窗口,则在分配新的光标窗口时它会关闭。

参数(Parameters)
window CursorWindow: The new cursor window, typically a remote cursor window.

Protected methods

checkPosition

Added in API level 1
void checkPosition ()

如果光标位置超出范围,则此函数将引发CursorIndexOutOfBoundsException。 get函数的子类实现应该在尝试检索数据之前调用它。

Hooray!