room/runtime/src/main/java/androidx/room/paging/LimitOffsetDataSource.java
@Nullable
    public List<T> loadRange(int startPosition, int loadCount) {
        final RoomSQLiteQuery sqLiteQuery = RoomSQLiteQuery.acquire(mLimitOffsetQuery,
                mSourceQuery.getArgCount() + 2);
        sqLiteQuery.copyArgumentsFrom(mSourceQuery);
        sqLiteQuery.bindLong(sqLiteQuery.getArgCount() - 1, loadCount);
        sqLiteQuery.bindLong(sqLiteQuery.getArgCount(), startPosition);
        if (mInTransaction) {
            mDb.beginTransaction();
            Cursor cursor = null;
            try {
                cursor = mDb.query(sqLiteQuery);
                List<T> rows = convertRows(cursor);
                mDb.setTransactionSuccessful();
                return rows;
            } finally {
                if (cursor != null) {
                    cursor.close();
                }
                mDb.endTransaction();
                sqLiteQuery.release();
            }
        } else {
            Cursor cursor = mDb.query(sqLiteQuery);
            //noinspection TryFinallyCanBeTryWithResources
            try {
                return convertRows(cursor);
            } finally {
                cursor.close();
                sqLiteQuery.release();
            }
        }
    }
/**
     * Return the rows from startPos to startPos + loadCount
     */
Return the rows from startPos to startPos + loadCount
Return the rows from startPos to startPos + loadCount
@Nullable
    public List<T> loadRange(int startPosition, int loadCount) {
        final RoomSQLiteQuery sqLiteQuery = RoomSQLiteQuery.acquire(mLimitOffsetQuery,
                mSourceQuery.getArgCount() + 2);
        sqLiteQuery.copyArgumentsFrom(mSourceQuery);
        sqLiteQuery.bindLong(sqLiteQuery.getArgCount() - 1, loadCount);
        sqLiteQuery.bindLong(sqLiteQuery.getArgCount(), startPosition);
        if (mInTransaction) {
            mDb.beginTransaction();
            Cursor cursor = null;
            try {
                cursor = mDb.query(sqLiteQuery);
                List<T> rows = convertRows(cursor);
                mDb.setTransactionSuccessful();
                return rows;
            } finally {
                if (cursor != null) {
                    cursor.close();
                }
                mDb.endTransaction();
                sqLiteQuery.release();
            }
        } else {
            Cursor cursor = mDb.query(sqLiteQuery);
            try {
                return convertRows(cursor);
            } finally {
                cursor.close();
                sqLiteQuery.release();
            }
        }
    }
@ Nullable public List < T > loadRange ( int startPosition , int loadCount ) { final RoomSQLiteQuery sqLiteQuery = RoomSQLiteQuery . acquire ( mLimitOffsetQuery , mSourceQuery . getArgCount ( ) + 2 ) ; sqLiteQuery . copyArgumentsFrom ( mSourceQuery ) ; sqLiteQuery . bindLong ( sqLiteQuery . getArgCount ( ) - 1 , loadCount ) ; sqLiteQuery . bindLong ( sqLiteQuery . getArgCount ( ) , startPosition ) ; if ( mInTransaction ) { mDb . beginTransaction ( ) ; Cursor cursor = null ; try { cursor = mDb . query ( sqLiteQuery ) ; List < T > rows = convertRows ( cursor ) ; mDb . setTransactionSuccessful ( ) ; return rows ; } finally { if ( cursor != null ) { cursor . close ( ) ; } mDb . endTransaction ( ) ; sqLiteQuery . release ( ) ; } } else { Cursor cursor = mDb . query ( sqLiteQuery ) ; try { return convertRows ( cursor ) ; } finally { cursor . close ( ) ; sqLiteQuery . release ( ) ; } } }
Return the rows from startPos to startPos + loadCount
Return the rows from startPos to startPos + loadCount
//noinspection TryFinallyCanBeTryWithResources