Code example for Closeable

Methods: close

0
 
public class IOUtil { 
    public static void closeQuietly(Closeable closeable) {
        if (closeable != null) {
            try { 
                closeable.close();
            } catch (Exception ignored) {
            } 
        } 
    } 
 
    /** 
     * Get a usable cache directory (external if available, internal otherwise). 
     * 
     * @param context The context to use 
     * @param uniqueName A unique directory name to append to the cache dir 
     * @return The cache dir 
     */ 
    public static File getDiskCacheDir(Context context, String uniqueName) {
        // Check if media is mounted or storage is built-in, if so, try and use external cache dir 
        // otherwise use internal cache dir