List of utility methods to do InputStream to File
void | writeStreamToFile(File target, InputStream in) First reads in all bytes fromt the stream into a byte buffer and then flushes them to file try { byte[] byteArray = streamToByteArray(in); FileOutputStream fileOutputStream = new FileOutputStream(target); fileOutputStream.write(byteArray); fileOutputStream.flush(); fileOutputStream.close(); } catch (IOException e) { throw new RuntimeException(e); ... |
void | writeStreamToFile(InputStream _actual, File _file) write Stream To File final OutputStream expected = new BufferedOutputStream(new FileOutputStream(_file)); try { int red; while ((red = _actual.read()) >= 0) expected.write(red); } finally { expected.close(); |
void | writeStreamToFile(InputStream in, OutputStream out) write Stream To File byte[] buffer = new byte[16384]; while (true) { int count = in.read(buffer); if (count < 0) break; out.write(buffer, 0, count); in.close(); ... |
void | writeStreamToFile(InputStream in, String fileName) Writes a stream out to a file try { FileOutputStream fos = new FileOutputStream(fileName); int ch; try { while (-1 != (ch = in.read())) { fos.write(ch); } catch (Exception e) { ... |
void | writeStreamToFile(InputStream inputStream, File file) write Stream To File FileOutputStream fout = new FileOutputStream(file);
copyStream(inputStream, fout);
fout.close();
|
void | writeStreamToFile(InputStream inputStream, File targetFile) Write a stream to a file FileOutputStream out = new FileOutputStream(targetFile); int count; byte[] buffer = new byte[1024]; while (0 < (count = inputStream.read(buffer))) { out.write(buffer, 0, count); |
File | writeStreamToFile(InputStream inputStream, String extension) write Stream To File File file = File.createTempFile("file" + UUID.randomUUID(), "." + extension); return writeStreamToFile(inputStream, extension, file); |
void | writeStreamToFile(InputStream is, File file) write Stream To File byte[] buffer = new byte[512]; BufferedOutputStream out = null; try { try { out = new BufferedOutputStream(new FileOutputStream(file)); while (true) { int read = is.read(buffer); if (read < 0) { ... |
void | writeStreamToFile(InputStream is, File out) Writes a given InputStream to a file.
byte[] b; try { FileOutputStream fos = new FileOutputStream(out); b = new byte[is.available()]; for (int n; (n = is.read(b)) != -1;) { fos.write(b); fos.close(); ... |
void | writeStreamToFile(InputStream is, File toFile) Write InputStream to provided class. OutputStream os = null; try { os = new FileOutputStream(toFile); byte[] buffer = new byte[4096]; for (int n; (n = is.read(buffer)) != -1;) { os.write(buffer, 0, n); } finally { ... |