public class IOUtils {
private static final String TAG = "IOUtils";
public static void closeSilently(Closeable c) {
if (c == null)
return;
try {
c.close();
} catch (Throwable t) {
Log.w(TAG, "fail to close", t);
}
}
public static void closeSilently(ParcelFileDescriptor c) {
if (c == null)
return;
try {
c.close();
} catch (Throwable t) {
Log.w(TAG, "fail to close", t);
}
}
public static void closeSilently(Cursor cursor) {
try {
if (cursor != null) cursor.close();
} catch (Throwable t) {
Log.w(TAG, "fail to close", t);
}
}
}
释放资源之IO工具类
最新推荐文章于 2023-07-12 23:18:26 发布