FileDocCategorySizeDatePackage
AbstractWindowedCursor.javaAPI DocAndroid 1.5 API5191Wed May 06 22:41:54 BST 2009android.database

AbstractWindowedCursor

public abstract class AbstractWindowedCursor extends AbstractCursor
A base class for Cursors that store their data in {@link CursorWindow}s.

Fields Summary
protected CursorWindow
mWindow
This needs be updated in {@link #onMove} by subclasses, and needs to be set to NULL when the contents of the cursor change.
Constructors Summary
Methods Summary
protected voidcheckPosition()

        super.checkPosition();
        
        if (mWindow == null) {
            throw new StaleDataException("Access closed cursor");
        }
    
public voidcopyStringToBuffer(int columnIndex, CharArrayBuffer buffer)

        checkPosition();
        
        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                super.copyStringToBuffer(columnIndex, buffer);
            }
        }
        
        mWindow.copyStringToBuffer(mPos, columnIndex, buffer);
    
public byte[]getBlob(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                return (byte[])getUpdatedField(columnIndex);
            }
        }

        return mWindow.getBlob(mPos, columnIndex);
    
public doublegetDouble(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Number value = (Number)getUpdatedField(columnIndex);
                return value.doubleValue();
            }
        }

        return mWindow.getDouble(mPos, columnIndex);
    
public floatgetFloat(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Number value = (Number)getUpdatedField(columnIndex);
                return value.floatValue();
            }
        }

        return mWindow.getFloat(mPos, columnIndex);
    
public intgetInt(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Number value = (Number)getUpdatedField(columnIndex);
                return value.intValue();
            }
        }

        return mWindow.getInt(mPos, columnIndex);
    
public longgetLong(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Number value = (Number)getUpdatedField(columnIndex);
                return value.longValue();
            }
        }

        return mWindow.getLong(mPos, columnIndex);
    
public shortgetShort(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Number value = (Number)getUpdatedField(columnIndex);
                return value.shortValue();
            }
        }

        return mWindow.getShort(mPos, columnIndex);
    
public java.lang.StringgetString(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                return (String)getUpdatedField(columnIndex);
            }
        }

        return mWindow.getString(mPos, columnIndex);
    
public CursorWindowgetWindow()

        return mWindow;
    
public booleanhasWindow()

        return mWindow != null;
    
public booleanisBlob(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                Object object = getUpdatedField(columnIndex);
                return object == null || object instanceof byte[];
            }
        }

        return mWindow.isBlob(mPos, columnIndex);
    
public booleanisNull(int columnIndex)

        checkPosition();

        synchronized(mUpdatedRows) {
            if (isFieldUpdated(columnIndex)) {
                return getUpdatedField(columnIndex) == null;
            }
        }

        return mWindow.isNull(mPos, columnIndex);
    
public voidsetWindow(CursorWindow window)
Set a new cursor window to cursor, usually set a remote cursor window

param
window cursor window

        if (mWindow != null) {
            mWindow.close();
        }
        mWindow = window;