Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void closeQuietly(InputStream in) { try { if (in != null) in.close(); } catch (IOException ignore) { } } public static void closeQuietly(OutputStream out) { try { if (out != null) out.close(); } catch (IOException ignore) { } } }