Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.Reader; public class Main { public static void closeQuitely(InputStream in) throws IOException { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } public static void closeQuitely(Reader reader) throws IOException { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } }