Here you can find the source of copyLarge(InputStream input, File outputFile)
private static long copyLarge(InputStream input, File outputFile) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private static long copyLarge(InputStream input, File outputFile) throws IOException { byte[] buffer = new byte[16384]; long count = 0; int n = 0; outputFile.getParentFile().mkdirs(); FileOutputStream output = new FileOutputStream(outputFile); try {//from w ww . ja v a2 s.c o m while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } } finally { output.close(); } return count; } }