Here you can find the source of saveToDisc(final InputStream fileInputStream, final String fileUploadPath)
public static void saveToDisc(final InputStream fileInputStream, final String fileUploadPath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static final int BUFFER_SIZE = 1024; public static void saveToDisc(final InputStream fileInputStream, final String fileUploadPath) throws IOException {/*from www .j a v a2 s. com*/ final OutputStream out = new FileOutputStream(new File(fileUploadPath)); int read = 0; byte[] bytes = new byte[BUFFER_SIZE]; while ((read = fileInputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); } }