Here you can find the source of save(InputStream in, File f)
public static void save(InputStream in, File f) throws IOException, Exception
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void save(InputStream in, File f) throws IOException, Exception { FileOutputStream out = new FileOutputStream(f); try {//from ww w. ja v a 2 s.co m byte[] buffer = new byte[4 * 1024]; int len = 0; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } } finally { in.close(); out.close(); } } }