Java tutorial
//package com.java2s; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void close(OutputStream os) { try { if (os != null) { os.close(); } } catch (Exception e) { // TODO: handle exception } } public static void close(InputStream is) { try { if (is != null) { is.close(); } } catch (Exception e) { // TODO: handle exception } } }