Code example for Closeable

Methods: close

0
	 *            The stream to close. 
	 */ 
	private static void closeStream(Closeable stream) {
		if (stream != null) {
			try { 
				stream.close();
			} catch (IOException e) {
				android.util.Log.e("IO", "Could not close stream", e);
			} 
		} 
	} 
 
	public static void downloadImage(String imageUrl, String filename,
			Context context) {
		try { 
			byte[] imageData = fetchImage(imageUrl);
			Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0,
					imageData.length);
			ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
			bitmap.compress(Bitmap.CompressFormat.JPEG, 75, byteArray);
			bitmap.recycle();