Java tutorial
//package com.java2s; import java.io.IOException; import java.io.OutputStream; public class Main { public static void closeOutputStream(OutputStream... ous) { if (ous != null && ous.length > 0) { for (OutputStream out : ous) { if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } } } }