CursorWrapper.java revision 7cd51efcbd2d083bf577696591ef1769034f7e2f
1/* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.database; 18 19import android.content.ContentResolver; 20import android.database.CharArrayBuffer; 21import android.net.Uri; 22import android.os.Bundle; 23 24import java.util.Map; 25 26/** 27 * Wrapper class for Cursor that delegates all calls to the actual cursor object 28 */ 29 30public class CursorWrapper implements Cursor { 31 32 public CursorWrapper(Cursor cursor) { 33 mCursor = cursor; 34 } 35 36 public void close() { 37 mCursor.close(); 38 } 39 40 public boolean isClosed() { 41 return mCursor.isClosed(); 42 } 43 44 public int getCount() { 45 return mCursor.getCount(); 46 } 47 48 public void deactivate() { 49 mCursor.deactivate(); 50 } 51 52 public boolean moveToFirst() { 53 return mCursor.moveToFirst(); 54 } 55 56 public int getColumnCount() { 57 return mCursor.getColumnCount(); 58 } 59 60 public int getColumnIndex(String columnName) { 61 return mCursor.getColumnIndex(columnName); 62 } 63 64 public int getColumnIndexOrThrow(String columnName) 65 throws IllegalArgumentException { 66 return mCursor.getColumnIndexOrThrow(columnName); 67 } 68 69 public String getColumnName(int columnIndex) { 70 return mCursor.getColumnName(columnIndex); 71 } 72 73 public String[] getColumnNames() { 74 return mCursor.getColumnNames(); 75 } 76 77 public double getDouble(int columnIndex) { 78 return mCursor.getDouble(columnIndex); 79 } 80 81 public Bundle getExtras() { 82 return mCursor.getExtras(); 83 } 84 85 public float getFloat(int columnIndex) { 86 return mCursor.getFloat(columnIndex); 87 } 88 89 public int getInt(int columnIndex) { 90 return mCursor.getInt(columnIndex); 91 } 92 93 public long getLong(int columnIndex) { 94 return mCursor.getLong(columnIndex); 95 } 96 97 public short getShort(int columnIndex) { 98 return mCursor.getShort(columnIndex); 99 } 100 101 public String getString(int columnIndex) { 102 return mCursor.getString(columnIndex); 103 } 104 105 public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) { 106 mCursor.copyStringToBuffer(columnIndex, buffer); 107 } 108 109 public byte[] getBlob(int columnIndex) { 110 return mCursor.getBlob(columnIndex); 111 } 112 113 public boolean getWantsAllOnMoveCalls() { 114 return mCursor.getWantsAllOnMoveCalls(); 115 } 116 117 public boolean isAfterLast() { 118 return mCursor.isAfterLast(); 119 } 120 121 public boolean isBeforeFirst() { 122 return mCursor.isBeforeFirst(); 123 } 124 125 public boolean isFirst() { 126 return mCursor.isFirst(); 127 } 128 129 public boolean isLast() { 130 return mCursor.isLast(); 131 } 132 133 public boolean isNull(int columnIndex) { 134 return mCursor.isNull(columnIndex); 135 } 136 137 public boolean moveToLast() { 138 return mCursor.moveToLast(); 139 } 140 141 public boolean move(int offset) { 142 return mCursor.move(offset); 143 } 144 145 public boolean moveToPosition(int position) { 146 return mCursor.moveToPosition(position); 147 } 148 149 public boolean moveToNext() { 150 return mCursor.moveToNext(); 151 } 152 153 public int getPosition() { 154 return mCursor.getPosition(); 155 } 156 157 public boolean moveToPrevious() { 158 return mCursor.moveToPrevious(); 159 } 160 161 public void registerContentObserver(ContentObserver observer) { 162 mCursor.registerContentObserver(observer); 163 } 164 165 public void registerDataSetObserver(DataSetObserver observer) { 166 mCursor.registerDataSetObserver(observer); 167 } 168 169 public boolean requery() { 170 return mCursor.requery(); 171 } 172 173 public Bundle respond(Bundle extras) { 174 return mCursor.respond(extras); 175 } 176 177 public void setNotificationUri(ContentResolver cr, Uri uri) { 178 mCursor.setNotificationUri(cr, uri); 179 } 180 181 public void unregisterContentObserver(ContentObserver observer) { 182 mCursor.unregisterContentObserver(observer); 183 } 184 185 public void unregisterDataSetObserver(DataSetObserver observer) { 186 mCursor.unregisterDataSetObserver(observer); 187 } 188 189 private Cursor mCursor; 190} 191 192