List of utility methods to do InputStream Copy to File
void | copyStreamToFile(InputStream in, File destination) Copy contents of specified InputStream, up to EOF, into the given destination file. OutputStream out = null; try { out = new FileOutputStream(destination); copyStreamToStream(in, out); } finally { if (out != null) { out.close(); |
void | copyStreamToFile(InputStream in, File out) copy Stream To File FileOutputStream fos = null; try { fos = new FileOutputStream(out); byte[] buf = new byte[1024]; int i = 0; while ((i = in.read(buf)) != -1) { fos.write(buf, 0, i); } finally { if (in != null) { try { in.close(); } catch (IOException e) { if (fos != null) { try { fos.close(); } catch (IOException e) { |
boolean | copyStreamToFile(InputStream in, File target) Copy the contents of the given inputstream to given targetfile. try { OutputStream out = new FileOutputStream(target); byte[] buf = new byte[16384]; int c; while ((c = in.read(buf)) != -1) out.write(buf, 0, c); in.close(); return true; ... |
void | copyStreamToFile(InputStream inputStream, File destFile) copy Stream To File File parentDir = destFile.getParentFile(); if (parentDir != null) { parentDir.mkdirs(); FileOutputStream fos = new FileOutputStream(destFile); copyStream(inputStream, fos); fos.close(); |
boolean | copyStreamToFile(InputStream pInputStream, File pFile) Copy an InputStream to a File FileOutputStream fos = null; try { fos = new FileOutputStream(pFile); } catch (FileNotFoundException e1) { e1.printStackTrace(); byte[] buffer = new byte[32768]; int read = 0; ... |
void | copyStreamToFile(InputStream source, File target) Copy an input stream to a file FileOutputStream outStream = new FileOutputStream(target);
copyInputStream(source, outStream);
|
void | copyStreamToFile(InputStream stream, File destFile) Copies data from the specified input stream to a file. OutputStream outStream = new FileOutputStream(destFile);
copyStream(stream, outStream);
outStream.flush();
outStream.close();
|
void | copyStreamToFile(InputStream stream, File destFile, long fileTime) copy Stream To File OutputStream outStream = new FileOutputStream(destFile);
copyStream(stream, outStream);
outStream.flush();
outStream.close();
destFile.setLastModified(fileTime);
|
void | copyStreamToFile(InputStream stream, File file) Copies the data from the InputStream to a file, then closes both when finished. FileOutputStream output = new FileOutputStream(file); final int oneMegabyte = 1 * 1024 * 1024; byte[] data = new byte[oneMegabyte]; while (true) { int bytesRead = stream.read(data); if (bytesRead < 0) { break; output.write(data, 0, bytesRead); stream.close(); output.close(); |