File(s) and InputStream/OutputStream
<p>Hello Stack Overflow community,</p>

<p>I am doing multistep processing on some data I am receiving with a java Servlet.  The current process I have is that I input the files to a server using Apache File Upload and convert them to a <code>File</code>. Then once <code>input1</code> is populated with data, I run through a flow similar to this (where the process functions are xsl transforms):   </p>

<pre><code>File input1 = new File(FILE_NAME);  // &lt;---this is populated with data
File output1 = new File(TEMP_FILE); // &lt;---this is the temporary file

InputStream read = new FileInputStream(input1); 
OuputStream out = new FileOutputStream(output1);

process1ThatReadsProcessesOutputs( read, out);

out.close();
read.close();

//this is basically a repeat of the above process!
File output2 = new File(RESULT_FILE);  // &lt;--- This is the result file 
InputStream read1 = new FileInputStream(output1);
OutputStream out1 = new FileOutputStream(output2);
Process2ThatReadsProcessesOutputs( read1, out1);
read1.close();
out1.close();
…
</code></pre>

<p>So my question is if there is a better way to do this so I do not have to create those temporary <code>File</code>s and recreate streams to those <code>File</code>s? (I am assuming I am incurring a decent performace penatly)</p>

<p>I saw this <a href="http://stackoverflow.com/questions/1225909/most-efficient-way-to-create-inputstream-from-outputstream">Most Efficient Way to create InputStream from OutputStream</a> but I am not sure if this is the best route to go...</p>
