List of utility methods to do InputStream to Temp File
File | writeStreamToTempFile(InputStream inputStream, String tempFileSuffix) Copy the data from an InputStream to a temp file. FileOutputStream outputStream = null; try { File file = File.createTempFile("mpxj", tempFileSuffix); outputStream = new FileOutputStream(file); byte[] buffer = new byte[1024]; while (true) { int bytesRead = inputStream.read(buffer); if (bytesRead == -1) { ... |
File | writeStreamToTempFile(String id, InputStream is) write Stream To Temp File if (is == null) throw new NullPointerException("Input stream is null"); File f = File.createTempFile(TESTPREFIX + id + "-", ".pdf"); f.deleteOnExit(); final OutputStream os = new BufferedOutputStream(new FileOutputStream(f)); try { writeInputToOutput(is, os); } finally { ... |