Here you can find the source of copyStreamIntoFile(File outFile, InputStream is)
public static void copyStreamIntoFile(File outFile, InputStream is) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void copyStreamIntoFile(File outFile, InputStream is) throws IOException { OutputStream os = new FileOutputStream(outFile); byte[] buf = new byte[1024]; int len;/*ww w . j a va2s . co m*/ while ((len = is.read(buf)) > 0) { os.write(buf, 0, len); } is.close(); os.close(); } }