Java tutorial
//package com.java2s; import java.io.Closeable; public class Main { public static void closeSafely(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (Exception e) { e.printStackTrace(); } } } }