Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; public class Main { public static void copyBitmapFromStream(InputStream in, File file) { FileOutputStream fout = null; try { fout = new FileOutputStream(file); byte[] buffer = new byte[1024]; int len = 0; while ((len = in.read(buffer)) != -1) { fout.write(buffer, 0, len); } fout.close(); in.close(); } catch (Exception e) { e.printStackTrace(); } } }