public abstract class AbstractCursor extends java.lang.Object implements Cursor
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractCursor.SelfContentObserver
Cursors use this class to track changes others make to their URI.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
mClosed |
protected ContentResolver |
mContentResolver |
protected java.lang.Long |
mCurrentRowID
If
mRowIdColumnIndex is not -1 this contains contains the value of
the column at mRowIdColumnIndex for the current row this cursor is
pointing at. |
protected int |
mPos |
protected int |
mRowIdColumnIndex
This must be set to the index of the row ID column by any
subclass that wishes to support updates.
|
protected java.util.HashMap<java.lang.Long,java.util.Map<java.lang.String,java.lang.Object>> |
mUpdatedRows
This HashMap contains a mapping from Long rowIDs to another Map
that maps from String column names to new values.
|
FIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING
Constructor and Description |
---|
AbstractCursor() |
Modifier and Type | Method and Description |
---|---|
void |
abortUpdates()
Deprecated.
|
protected void |
checkPosition()
This function throws CursorIndexOutOfBoundsException if
the cursor position is out of bounds.
|
void |
close() |
boolean |
commitUpdates()
Deprecated.
|
boolean |
commitUpdates(java.util.Map<? extends java.lang.Long,? extends java.util.Map<java.lang.String,java.lang.Object>> values)
Deprecated.
|
void |
copyStringToBuffer(int columnIndex,
CharArrayBuffer buffer) |
void |
deactivate() |
void |
deactivateInternal() |
boolean |
deleteRow()
Deprecated.
|
void |
fillWindow(int position,
android.database.CursorWindow window)
Copy data from cursor to CursorWindow
|
protected void |
finalize() |
byte[] |
getBlob(int column) |
int |
getColumnCount() |
int |
getColumnIndex(java.lang.String columnName) |
int |
getColumnIndexOrThrow(java.lang.String columnName) |
java.lang.String |
getColumnName(int columnIndex) |
abstract java.lang.String[] |
getColumnNames() |
abstract int |
getCount() |
protected DataSetObservable |
getDataSetObservable()
This is hidden until the data set change model has been re-evaluated.
|
abstract double |
getDouble(int column) |
Bundle |
getExtras() |
abstract float |
getFloat(int column) |
abstract int |
getInt(int column) |
abstract long |
getLong(int column) |
Uri |
getNotificationUri() |
int |
getPosition() |
abstract short |
getShort(int column) |
abstract java.lang.String |
getString(int column) |
abstract int |
getType(int column)
Returns data type of the given column's value.
|
protected java.lang.Object |
getUpdatedField(int columnIndex)
This function returns the uncommitted updated value for the field
at columnIndex.
|
boolean |
getWantsAllOnMoveCalls() |
CursorWindow |
getWindow()
returns a pre-filled window, return NULL if no such window
|
boolean |
hasUpdates()
Deprecated.
|
boolean |
isAfterLast() |
boolean |
isBeforeFirst() |
boolean |
isClosed() |
protected boolean |
isFieldUpdated(int columnIndex)
This function returns true if the field has been updated and is
used in conjunction with
getUpdatedField(int) to allow subclasses to
support reading uncommitted updates. |
boolean |
isFirst() |
boolean |
isLast() |
abstract boolean |
isNull(int column) |
boolean |
move(int offset) |
boolean |
moveToFirst() |
boolean |
moveToLast() |
boolean |
moveToNext() |
boolean |
moveToPosition(int position) |
boolean |
moveToPrevious() |
protected void |
notifyDataSetChange()
This is hidden until the data set change model has been re-evaluated.
|
protected void |
onChange(boolean selfChange)
Subclasses must call this method when they finish committing updates to notify all
observers.
|
boolean |
onMove(int oldPosition,
int newPosition)
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.
|
void |
registerContentObserver(ContentObserver observer) |
void |
registerDataSetObserver(DataSetObserver observer) |
boolean |
requery() |
Bundle |
respond(Bundle extras) |
void |
setNotificationUri(ContentResolver cr,
Uri notifyUri)
Specifies a content URI to watch for changes.
|
boolean |
supportsUpdates()
Deprecated.
|
void |
unregisterContentObserver(ContentObserver observer) |
void |
unregisterDataSetObserver(DataSetObserver observer) |
boolean |
update(int columnIndex,
java.lang.Object obj)
Deprecated.
|
boolean |
updateBlob(int columnIndex,
byte[] value)
Deprecated.
|
boolean |
updateDouble(int columnIndex,
double value)
Deprecated.
|
boolean |
updateFloat(int columnIndex,
float value)
Deprecated.
|
boolean |
updateInt(int columnIndex,
int value)
Deprecated.
|
boolean |
updateLong(int columnIndex,
long value)
Deprecated.
|
boolean |
updateShort(int columnIndex,
short value)
Deprecated.
|
boolean |
updateString(int columnIndex,
java.lang.String value)
Deprecated.
|
boolean |
updateToNull(int columnIndex)
Deprecated.
|
protected java.util.HashMap<java.lang.Long,java.util.Map<java.lang.String,java.lang.Object>> mUpdatedRows
protected int mRowIdColumnIndex
protected int mPos
protected java.lang.Long mCurrentRowID
mRowIdColumnIndex
is not -1 this contains contains the value of
the column at mRowIdColumnIndex
for the current row this cursor is
pointing at.protected ContentResolver mContentResolver
protected boolean mClosed
public abstract int getCount()
public abstract java.lang.String[] getColumnNames()
public abstract java.lang.String getString(int column)
public abstract short getShort(int column)
public abstract int getInt(int column)
public abstract long getLong(int column)
public abstract float getFloat(int column)
public abstract double getDouble(int column)
public abstract boolean isNull(int column)
public abstract int getType(int column)
Cursor
#getInt(int)
, #getFloat(int)
etc.
Returned column types are
public byte[] getBlob(int column)
public CursorWindow getWindow()
public int getColumnCount()
public void deactivate()
public void deactivateInternal()
public boolean requery()
public boolean isClosed()
public void close()
public boolean commitUpdates(java.util.Map<? extends java.lang.Long,? extends java.util.Map<java.lang.String,java.lang.Object>> values)
public boolean deleteRow()
public boolean onMove(int oldPosition, int newPosition)
oldPosition
- the position that we're moving fromnewPosition
- the position that we're moving topublic void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)
public final int getPosition()
public final boolean moveToPosition(int position)
public void fillWindow(int position, android.database.CursorWindow window)
position
- start position of datawindow
- public final boolean move(int offset)
public final boolean moveToFirst()
public final boolean moveToLast()
public final boolean moveToNext()
public final boolean moveToPrevious()
public final boolean isFirst()
public final boolean isLast()
public final boolean isBeforeFirst()
public final boolean isAfterLast()
public int getColumnIndex(java.lang.String columnName)
public int getColumnIndexOrThrow(java.lang.String columnName)
public java.lang.String getColumnName(int columnIndex)
public boolean updateBlob(int columnIndex, byte[] value)
public boolean updateString(int columnIndex, java.lang.String value)
public boolean updateShort(int columnIndex, short value)
public boolean updateInt(int columnIndex, int value)
public boolean updateLong(int columnIndex, long value)
public boolean updateFloat(int columnIndex, float value)
public boolean updateDouble(int columnIndex, double value)
public boolean updateToNull(int columnIndex)
public boolean update(int columnIndex, java.lang.Object obj)
public boolean hasUpdates()
true
if there are pending updates that have not yet been committed.true
if there are pending updates that have not yet been committed.public void abortUpdates()
public boolean commitUpdates()
public boolean supportsUpdates()
public void registerContentObserver(ContentObserver observer)
public void unregisterContentObserver(ContentObserver observer)
protected void notifyDataSetChange()
protected DataSetObservable getDataSetObservable()
public void registerDataSetObserver(DataSetObserver observer)
public void unregisterDataSetObserver(DataSetObserver observer)
protected void onChange(boolean selfChange)
selfChange
- public void setNotificationUri(ContentResolver cr, Uri notifyUri)
cr
- The content resolver from the caller's context.notifyUri
- The URI to watch for changes. This can be a
specific row URI, or a base URI for a whole class of content.public Uri getNotificationUri()
public boolean getWantsAllOnMoveCalls()
public Bundle getExtras()
public Bundle respond(Bundle extras)
protected boolean isFieldUpdated(int columnIndex)
getUpdatedField(int)
to allow subclasses to
support reading uncommitted updates. NOTE: This function and
getUpdatedField(int)
should be called together inside of a
block synchronized on mUpdatedRows.columnIndex
- the column index of the field to checkprotected java.lang.Object getUpdatedField(int columnIndex)
isFieldUpdated(int)
should
be called together inside of a block synchronized on mUpdatedRows.columnIndex
- the column index of the field to retrieveprotected void checkPosition()
CursorIndexOutOfBoundsException
protected void finalize()
finalize
in class java.lang.Object