Java tutorial
//package com.java2s; import android.support.annotation.Nullable; import java.io.Closeable; import java.io.IOException; public class Main { @SuppressWarnings("ConstantConditions") public static void close(@Nullable Closeable c) { if (c != null && c instanceof Closeable) { // java.lang.IncompatibleClassChangeError: interface not implemented try { c.close(); } catch (IOException e) { // silence } } } }