Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.Closeable;

import android.database.Cursor;

import android.os.ParcelFileDescriptor;

public class Main {
    /**
     * Close a {@link Closeable} stream without throwing any exception
     * 
     * @param c
     */
    public static void closeSilently(final Closeable c) {
        if (c == null)
            return;
        try {
            c.close();
        } catch (final Throwable t) {
        }
    }

    public static void closeSilently(final ParcelFileDescriptor c) {
        if (c == null)
            return;
        try {
            c.close();
        } catch (final Throwable t) {
        }
    }

    public static void closeSilently(Cursor cursor) {
        if (cursor == null)
            return;
        try {
            if (cursor != null)
                cursor.close();
        } catch (Throwable t) {
        }
    }
}