Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void close(InputStream is) { try { if (is != null) is.close(); } catch (IOException e) { e.printStackTrace(); } } public static void close(ByteArrayOutputStream os) { try { if (os != null) os.close(); } catch (IOException e) { e.printStackTrace(); } } }