Java tutorial
//package com.java2s; //License from project: Apache License import android.util.Log; import java.io.IOException; import java.io.OutputStream; public class Main { /** * Close a ByteArrayOutputStream passed in. * * @param stream - ByteArrayOutputStream to be closed. */ public static void closeOutputStream(OutputStream stream, String tag) { if (stream != null) { try { stream.close(); } catch (IOException e) { Log.e(tag, "Exception occured when closing ByteArrayOutputStream." + e); } } } }