public abstract class

AbstractWindowedCursor

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

Class Overview

A base class for Cursors that store their data in CursorWindows.

Summary

Fields
protected CursorWindow mWindow This needs be updated in onMove(int, int) by subclasses, and needs to be set to NULL when the contents of the cursor change.
[Expand]
Inherited Fields
From class android.database.AbstractCursor
Public Constructors
AbstractWindowedCursor()
Public Methods
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.
CursorWindow getWindow()
returns a pre-filled window, return NULL if no such window
boolean hasWindow()
boolean isBlob(int columnIndex)
boolean isFloat(int columnIndex)
boolean isLong(int columnIndex)
boolean isNull(int columnIndex)
Returns true if the value in the indicated column is null.
boolean isString(int columnIndex)
void setWindow(CursorWindow window)
Set a new cursor window to cursor, usually set a remote cursor window
Protected Methods
void checkPosition()
This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds.
[Expand]
Inherited Methods
From class android.database.AbstractCursor
From class java.lang.Object
From interface android.database.CrossProcessCursor
From interface android.database.Cursor

Fields

protected CursorWindow mWindow

Since: API Level 1

This needs be updated in onMove(int, int) by subclasses, and needs to be set to NULL when the contents of the cursor change.

Public Constructors

public AbstractWindowedCursor ()

Since: API Level 1

Public Methods

public void copyStringToBuffer (int columnIndex, CharArrayBuffer buffer)

Since: API Level 1

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 the zero-based index of the target column. if the target column is null, return buffer
buffer the buffer to copy the text into.

public byte[] getBlob (int columnIndex)

Since: API Level 1

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

If the native content of that column is not blob exception may throw

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a byte array.

public double getDouble (int columnIndex)

Since: API Level 1

Returns the value of the requested column as a double.

If the native content of that column is not numeric the result will be the result of passing the column value to Double.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a double.

public float getFloat (int columnIndex)

Since: API Level 1

Returns the value of the requested column as a float.

If the native content of that column is not numeric the result will be the result of passing the column value to Float.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a float.

public int getInt (int columnIndex)

Since: API Level 1

Returns the value of the requested column as an int.

If the native content of that column is not numeric the result will be the result of passing the column value to Integer.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as an int.

public long getLong (int columnIndex)

Since: API Level 1

Returns the value of the requested column as a long.

If the native content of that column is not numeric the result will be the result of passing the column value to Long.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a long.

public short getShort (int columnIndex)

Since: API Level 1

Returns the value of the requested column as a short.

If the native content of that column is not numeric the result will be the result of passing the column value to Short.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a short.

public String getString (int columnIndex)

Since: API Level 1

Returns the value of the requested column as a String.

If the native content of that column is not text the result will be the result of passing the column value to String.valueOf(x).

Parameters
columnIndex the zero-based index of the target column.
Returns
  • the value of that column as a String.

public CursorWindow getWindow ()

Since: API Level 1

returns a pre-filled window, return NULL if no such window

public boolean hasWindow ()

Since: API Level 1

public boolean isBlob (int columnIndex)

Since: API Level 1

public boolean isFloat (int columnIndex)

Since: API Level 5

public boolean isLong (int columnIndex)

Since: API Level 5

public boolean isNull (int columnIndex)

Since: API Level 1

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

Parameters
columnIndex the zero-based index of the target column.
Returns
  • whether the column value is null.

public boolean isString (int columnIndex)

Since: API Level 5

public void setWindow (CursorWindow window)

Since: API Level 1

Set a new cursor window to cursor, usually set a remote cursor window

Parameters
window cursor window

Protected Methods

protected void checkPosition ()

Since: API Level 1

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.