Here you can find the source of copyFile(InputStream is, File newFile)
Parameter | Description |
---|---|
is | a parameter |
pathFileDestign | a parameter |
Parameter | Description |
---|---|
FileNotFoundException | an exception |
IOException | an exception |
public static boolean copyFile(InputStream is, File newFile) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/*www . ja v a 2s .c o m*/ * Copia de um ImputStream para um Arquivo a ser criado no caminho * pathFileDestign * * @param is * @param pathFileDestign * @return * @throws FileNotFoundException * @throws IOException */ public static boolean copyFile(InputStream is, File newFile) throws FileNotFoundException, IOException { FileOutputStream out = new FileOutputStream(newFile); BufferedInputStream inBuffer = new BufferedInputStream(is); BufferedOutputStream outBuffer = new BufferedOutputStream(out); int theByte = 0; while ((theByte = inBuffer.read()) > -1) { outBuffer.write(theByte); } outBuffer.close(); inBuffer.close(); out.close(); is.close(); return true; } }