public class CrossProcessCursorWrapper extends CursorWrapper implements CrossProcessCursor
CrossProcessCursor
.
If the wrapped cursor implements CrossProcessCursor
, then the wrapper
delegates fillWindow(int, android.database.CursorWindow)
, getWindow()
and onMove(int, int)
to it.
Otherwise, the wrapper provides default implementations of these methods that
traverse the contents of the cursor similar to AbstractCursor.fillWindow(int, android.database.CursorWindow)
.
This wrapper can be used to adapt an ordinary Cursor
into a
CrossProcessCursor
.
mCursor
FIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING
Constructor and Description |
---|
CrossProcessCursorWrapper(Cursor cursor)
Creates a cross process cursor wrapper.
|
Modifier and Type | Method and Description |
---|---|
void |
fillWindow(int position,
CursorWindow window)
Copies cursor data into the window.
|
CursorWindow |
getWindow()
Returns a pre-filled window that contains the data within this cursor.
|
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.
|
close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getDouble, getExtras, getFloat, getInt, getLong, getNotificationUri, getPosition, getShort, getString, getType, getWantsAllOnMoveCalls, getWrappedCursor, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isNull, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getDouble, getExtras, getFloat, getInt, getLong, getNotificationUri, getPosition, getShort, getString, getType, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isNull, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver
public CrossProcessCursorWrapper(Cursor cursor)
cursor
- The underlying cursor to wrap.public void fillWindow(int position, CursorWindow window)
CrossProcessCursor
Clears the window and fills it with data beginning at the requested row position until all of the data in the cursor is exhausted or the window runs out of space.
The filled window uses the same row indices as the original cursor. For example, if you fill a window starting from row 5 from the cursor, you can query the contents of row 5 from the window just by asking it for row 5 because there is a direct correspondence between the row indices used by the cursor and the window.
The current position of the cursor, as returned by Cursor.getPosition()
,
is not changed by this method.
fillWindow
in interface CrossProcessCursor
position
- The zero-based index of the first row to copy into the window.window
- The window to fill.public CursorWindow getWindow()
CrossProcessCursor
In particular, the window contains the row indicated by Cursor.getPosition()
.
The window's contents are automatically scrolled whenever the current
row moved outside the range covered by the window.
getWindow
in interface CrossProcessCursor
public boolean onMove(int oldPosition, int newPosition)
CrossProcessCursor
This function should be called by methods such as Cursor.moveToPosition(int)
,
so it will typically not be called from outside of the cursor class itself.
onMove
in interface CrossProcessCursor
oldPosition
- The position that we're moving from.newPosition
- The position that we're moving to.