Here you can find the source of copyRAWFile(InputStream inStream, FileOutputStream outStream)
public static void copyRAWFile(InputStream inStream, FileOutputStream outStream)
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; public class Main { public static void copyRAWFile(InputStream inStream, File newfile) { try {/*from w w w .j a va 2s . c o m*/ FileOutputStream fs = new FileOutputStream(newfile); copyRAWFile(inStream, fs); fs.close(); } catch (Exception e) { e.printStackTrace(); } } public static void copyRAWFile(InputStream inStream, FileOutputStream outStream) { try { int bytesum = 0, byteread = 0; byte[] buffer = new byte[102400]; //100k buffer while ((byteread = inStream.read(buffer)) != -1) { bytesum += byteread; System.out.println(bytesum); outStream.write(buffer, 0, byteread); } inStream.close(); } catch (Exception e) { e.printStackTrace(); } } }