List of utility methods to do InputStream to File
void | writeStreamToFile(InputStream is, String fileName) Write a stream's content to a file. File file = new File(fileName); file.getParentFile().mkdirs(); FileOutputStream fos = null; byte[] buf = new byte[BUFFER_LENGTH]; try { fos = new FileOutputStream(file); int len; while ((len = is.read(buf, 0, BUFFER_LENGTH)) > -1) { ... |
File | writeStreamToFile(InputStream is, String path) Reads an input stream and writes its content to a file File file = new File(path); BufferedInputStream bis = new BufferedInputStream(is); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); int inByte; while ((inByte = bis.read()) != -1) { bos.write(inByte); bis.close(); ... |
void | writeStreamToFile(InputStream skypeFrameworkStream, File skypeFramework) write Stream To File FileOutputStream out = new FileOutputStream(skypeFramework); int count; byte[] buffer = new byte[1024]; while (0 < (count = skypeFrameworkStream.read(buffer))) { out.write(buffer, 0, count); |
void | writeStreamToFile(InputStream stream, File file) write Stream To File try { OutputStream out = new FileOutputStream(file); byte[] buffer = new byte[1024]; int read; while ((read = stream.read(buffer)) > 0) { out.write(buffer, 0, read); out.close(); ... |
void | writeStreamToFile(String chemin, String contenu) ecrire un flux dans un fichier PrintWriter pw = null; try { pw = new PrintWriter(new FileWriter(new String(chemin))); pw.print(contenu); pw.close(); } catch (Exception e) { e.printStackTrace(); |