Java tutorial
//package com.java2s; //License from project: Apache License import java.io.Closeable; import java.io.IOException; public class Main { /** * Safely closes the given {@link Closeable} without throwing * any exceptions due to null pointers or {@link IOException}s. * * @param closeable The {@link Closeable} to close. */ static void safeClose(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { } } } }