List of utility methods to do InputStream to File
void | inputStream2File(InputStream in, File file) input Stream File OutputStream os = new FileOutputStream(file); int bytesRead = 0; byte[] buffer = new byte[8192]; try { while ((bytesRead = in.read(buffer, 0, 8192)) != -1) { os.write(buffer, 0, bytesRead); } finally { ... |
String | InputStream2File(InputStream in, String filePath) Input Stream File FileOutputStream fos = null; String fileName = filePath + File.separator + System.currentTimeMillis() + ".jpg"; try { int flag = 0; fos = new FileOutputStream(fileName); byte[] b = new byte[1024]; while ((flag = in.read(b, 0, 1024)) != -1) { fos.write(b, 0, flag); ... |
long | InputStreamToFile(final InputStream stream, final File file) Input Stream To File final FileWriter w = new FileWriter(file); final InputStreamReader r = new InputStreamReader(stream); final long result = readerToWriter(new InputStreamReader(stream), w); closeProperly(w); closeProperly(r); return result; |
void | inputStreamToFile(InputStream byteStream, String pathFileName) input Stream To File InputStream bStream = null; FileOutputStream fileOutStream = null; try { bStream = byteStream; fileOutStream = new FileOutputStream(pathFileName); byte[] buffer = new byte[10]; int nbytes = 0; while ((nbytes = bStream.read(buffer)) != -1) { ... |
void | inputStreamToFile(InputStream in, File file) input Stream To File BufferedOutputStream out = null; byte[] b = new byte[8192]; try { out = new BufferedOutputStream(new FileOutputStream(file)); for (int n; (n = in.read(b)) != -1;) { out.write(b, 0, n); } catch (Exception e) { ... |
void | inputStreamToFile(InputStream ins, File file) input Stream To File OutputStream os = new FileOutputStream(file); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { os.write(buffer, 0, bytesRead); os.close(); ins.close(); ... |
void | inputstreamtofile(InputStream ins, File file) inputstreamtofile OutputStream os = null; try { os = new FileOutputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); int bytesRead = 0; byte[] buffer = new byte[8192]; ... |
File | inputStreamToFile(InputStream is) input Stream To File File contentFile = File.createTempFile("tmpCont", ".txt"); OutputStream outputStream = null; outputStream = new FileOutputStream(contentFile); int read = 0; byte[] bytes = new byte[1024]; while ((read = is.read(bytes)) != -1) { outputStream.write(bytes, 0, read); outputStream.close(); return contentFile; |
void | inputStreamToFile(InputStream is, File targetFile) input Stream To File byte[] buffer = ByteStreams.toByteArray(is); OutputStream outStream = new FileOutputStream(targetFile); outStream.write(buffer); outStream.flush(); outStream.close(); |
void | inputStreamToFile(InputStream stream, File file) input Stream To File FileOutputStream output = null; try { output = new FileOutputStream(file); copyStream(stream, output); } finally { if (output != null) { output.close(); |