152e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee/* 252e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * Copyright (C) 2011 The Android Open Source Project 352e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * 452e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * Licensed under the Apache License, Version 2.0 (the "License"); 552e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * you may not use this file except in compliance with the License. 652e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * You may obtain a copy of the License at 752e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * 852e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * http://www.apache.org/licenses/LICENSE-2.0 952e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * 1052e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * Unless required by applicable law or agreed to in writing, software 1152e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * distributed under the License is distributed on an "AS IS" BASIS, 1252e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1352e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * See the License for the specific language governing permissions and 1452e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * limitations under the License 1552e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee */ 1652e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjeepackage com.android.providers.contacts.util; 1752e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee 1852e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjeeimport android.database.Cursor; 1952e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee 2052e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee/** 2152e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee * Utility methods for closing database cursors. 2252e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee */ 2352e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjeepublic class CloseUtils { 2452e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee private CloseUtils() { 2552e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee } 2652e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee 2752e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee /** If the argument is non-null, close the cursor. */ 2852e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee public static void closeQuietly(Cursor cursor) { 2952e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee if (cursor != null) { 3052e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee cursor.close(); 3152e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee } 3252e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee } 3352e8d24f8492116f0b49b147576ce13a5f913aa2Debashish Chatterjee} 34