Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.IOException; public class Main { /** * * The method try to close safely an object that implementes Closable * interface. If an error occurs, the method will NOT throw any exception, * but will * * return false * * * * @param closeable * * @return False if fail, otherwise return true. */ public static boolean close(java.io.Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException ex) { return false; } } return true; } }