Android
android.database
public class

android.database.CursorWindow

java.lang.Object
android.database.CursorWindow Parcelable

A buffer containing multiple cursor rows.

Summary

Constants

      Value  
Creator<CursorWindow CREATOR       
Constants inherited from interface android.os.Parcelable

Public Constructors

            CursorWindow(boolean localWindow)
Creates a new empty window.

Public Methods

  synchronized        void  acquireReference()
          boolean  allocRow()
Allocate a row in cursor window
          void  clear()
Clears out the existing contents of the window, making it safe to reuse for new data.
          void  close()
Cleans up the native resources associated with the window.
          void  copyStringToBuffer(int row, int col, CharArrayBuffer buffer)
copy the text for the given field in the provided char array.
          int  describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
          void  freeLastRow()
Free the last row
          byte[]  getBlob(int row, int col)
Returns a byte array for the given field.
          double  getDouble(int row, int col)
Returns a double for the given field.
          float  getFloat(int row, int col)
Returns a float for the given field.
          int  getInt(int row, int col)
Returns an int for the given field.
          long  getLong(int row, int col)
Returns a long for the given field.
          int  getNumRows()
Returns the number of rows in this window.
          short  getShort(int row, int col)
Returns a short for the given field.
          int  getStartPosition()
Returns the starting position of this window within the entire Cursor's result set.
          String  getString(int row, int col)
Returns a String for the given field.
          boolean  isBlob(int row, int col)
Checks if a field contains either a blob or is null.
          boolean  isNull(int row, int col)
Returns true if given field is NULL.
      static    CursorWindow  newFromParcel(Parcel p)
          boolean  putBlob(byte[] value, int row, int col)
copy byte array to cursor window
          boolean  putDouble(double value, int row, int col)
Copy double to cursor window
          boolean  putLong(long value, int row, int col)
Copy integer to cursor window
          boolean  putNull(int row, int col)
Set the [row, col] value to NULL
          boolean  putString(String value, int row, int col)
Copy String to cursor window
  synchronized        void  releaseReference()
          boolean  setNumColumns(int columnNum)
Set number of Columns
          void  setStartPosition(int pos)
Set the start position of cursor window
          void  writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.

Protected Methods

          void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object
Methods inherited from interface android.os.Parcelable

Details

Constants

public static final Creator<CursorWindow> CREATOR

Public Constructors

public CursorWindow(boolean localWindow)

Creates a new empty window.

Parameters

localWindow true if this window will be used in this process only

Public Methods

public synchronized void acquireReference()

public boolean allocRow()

Allocate a row in cursor window

Returns

  • false if cursor window is out of memory

public void clear()

Clears out the existing contents of the window, making it safe to reuse for new data. Note that the number of columns in the window may NOT change across a call to clear().

public void close()

Cleans up the native resources associated with the window.

public void copyStringToBuffer(int row, int col, CharArrayBuffer buffer)

copy the text for the given field in the provided char array.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from
buffer the CharArrayBuffer to copy the text into, If the requested string is larger than the buffer a new char buffer will be created to hold the string. and assigne to CharArrayBuffer.data

public int describeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

public void freeLastRow()

Free the last row

public byte[] getBlob(int row, int col)

Returns a byte array for the given field.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a String value for the given field

public double getDouble(int row, int col)

Returns a double for the given field. row is 0 based

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a double value for the given field

public float getFloat(int row, int col)

Returns a float for the given field. row is 0 based

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a float value for the given field

public int getInt(int row, int col)

Returns an int for the given field.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • an int value for the given field

public long getLong(int row, int col)

Returns a long for the given field. row is 0 based

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a long value for the given field

public int getNumRows()

Returns the number of rows in this window.

Returns

  • the number of rows in this window.

public short getShort(int row, int col)

Returns a short for the given field. row is 0 based

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a short value for the given field

public int getStartPosition()

Returns the starting position of this window within the entire Cursor's result set.

Returns

  • the starting position of this window within the entire Cursor's result set.

public String getString(int row, int col)

Returns a String for the given field.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • a String value for the given field

public boolean isBlob(int row, int col)

Checks if a field contains either a blob or is null.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • true if given field is NULL or a blob

public boolean isNull(int row, int col)

Returns true if given field is NULL.

Parameters

row the row to read from, row - getStartPosition() being the actual row in the window
col the column to read from

Returns

  • true if given field is NULL

public static CursorWindow newFromParcel(Parcel p)

public boolean putBlob(byte[] value, int row, int col)

copy byte array to cursor window

Returns

  • false if fail to copy

public boolean putDouble(double value, int row, int col)

Copy double to cursor window

Returns

  • false if fail to copy

public boolean putLong(long value, int row, int col)

Copy integer to cursor window

Returns

  • false if fail to copy

public boolean putNull(int row, int col)

Set the [row, col] value to NULL

Returns

  • false if fail to copy

public boolean putString(String value, int row, int col)

Copy String to cursor window

Returns

  • false if fail to copy

public synchronized void releaseReference()

public boolean setNumColumns(int columnNum)

Set number of Columns

Returns

  • true if success

public void setStartPosition(int pos)

Set the start position of cursor window

public void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Protected Methods

protected void finalize()

Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56