Java 类android.database.AbstractWindowedCursor 实例源码

项目:FMTech    文件:cqm.java   
static boolean b(Cursor paramCursor)
{
  boolean bool1 = true;
  if ((paramCursor != null) && (!paramCursor.isClosed()))
  {
    if ((paramCursor != null) && (paramCursor.getColumnCount() == bri.a.length)) {}
    for (boolean bool2 = bool1; bool2; bool2 = false)
    {
      if ((paramCursor instanceof AbstractWindowedCursor)) {
        bool1 = ((AbstractWindowedCursor)paramCursor).hasWindow();
      }
      return bool1;
    }
  }
  return false;
}
项目:android_external_GmsApi    文件:DataHolder.java   
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
static int getCursorType(Cursor cursor, int i) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return cursor.getType(i);
    }
    if (cursor instanceof AbstractWindowedCursor) {
        CursorWindow cursorWindow = ((AbstractWindowedCursor) cursor).getWindow();
        int pos = cursor.getPosition();
        int type = -1;
        if (cursorWindow.isNull(pos, i)) {
            type = FIELD_TYPE_NULL;
        } else if (cursorWindow.isLong(pos, i)) {
            type = FIELD_TYPE_INTEGER;
        } else if (cursorWindow.isFloat(pos, i)) {
            type = FIELD_TYPE_FLOAT;
        } else if (cursorWindow.isString(pos, i)) {
            type = FIELD_TYPE_STRING;
        } else if (cursorWindow.isBlob(pos, i)) {
            type = FIELD_TYPE_BLOB;
        }

        return type;
    }
    throw new RuntimeException("Unsupported cursor on this platform!");
}
项目:mc_backup    文件:ReadingListClientRecordFactory.java   
@SuppressWarnings("deprecation")
private final void fillGingerbread(ExtendedJSONObject o, Cursor c, String f, int i) {
  if (!(c instanceof AbstractWindowedCursor)) {
    throw new IllegalStateException("Unable to handle cursors that don't have a CursorWindow!");
  }

  final AbstractWindowedCursor sqc = (AbstractWindowedCursor) c;
  final CursorWindow w = sqc.getWindow();
  final int pos = c.getPosition();
  if (w.isNull(pos, i)) {
    putNull(o, f);
  } else if (w.isString(pos, i)) {
    put(o, f, c.getString(i));
  } else if (w.isLong(pos, i)) {
    put(o, f, c.getLong(i));
  } else if (w.isFloat(pos, i)) {
    o.put(f, c.getDouble(i));
  } else if (w.isBlob(pos, i)) {
    // TODO: this probably doesn't serialize correctly.
    o.put(f, c.getBlob(i));
  }
}
项目:sqlitemagic    文件:FastCursor.java   
private FastCursor(@NonNull AbstractWindowedCursor cursor) {
  backingCursor = cursor;
  count = cursor.getCount(); // fills cursor window
  window = cursor.getWindow();
  windowStart = window.getStartPosition();
  windowEnd = windowStart + window.getNumRows();
  position = -1;
}
项目:android_xcore    文件:CursorUtils.java   
/**
 * Read the entire contents of a cursor row and store them in a ContentValues.
 *
 * @param cursor the cursor to read from.
 * @param values the {@link ContentValues} to put the row into.
 */
public static void cursorRowToContentValues(Cursor cursor, ContentValues values) {
    AbstractWindowedCursor awc =
            (cursor instanceof AbstractWindowedCursor) ? (AbstractWindowedCursor) cursor : null;

    String[] columns = cursor.getColumnNames();
    int length = columns.length;
    for (int i = 0; i < length; i++) {
        if (awc != null && isBlob(awc, i)) {
            values.put(columns[i], cursor.getBlob(i));
        } else {
            values.put(columns[i], cursor.getString(i));
        }
    }
}
项目:android_xcore    文件:CursorUtils.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static boolean isBlob(AbstractWindowedCursor awc, int columnIndex) {
    if (UiUtil.hasHoneycomb()) {
        int type = awc.getType(columnIndex);
        return type == AbstractWindowedCursor.FIELD_TYPE_BLOB;
    } else {
        return awc.isBlob(columnIndex);
    }
}
项目:sqlitemagic    文件:FastCursor.java   
static Cursor tryCreate(@NonNull Cursor cursor) {
  if (cursor instanceof AbstractWindowedCursor) {
    return new FastCursor((AbstractWindowedCursor) cursor);
  }
  return cursor;
}
项目:android_external_GmsApi    文件:DataHolder.java   
/**
 * Creates a data holder wrapping the provided cursor, with provided status code and metadata.
 *
 * @param cursor     The cursor containing the data.
 * @param statusCode The status code of this {@link DataHolder}.
 * @param metadata   The metadata associated with this {@link DataHolder} (may be null).
 */
public DataHolder(AbstractWindowedCursor cursor, int statusCode, Bundle metadata) {
    this(cursor.getColumnNames(), createCursorWindows(cursor), statusCode, metadata);
}