Is there a way (without buffering the whole Inputstream) to take the HttpServletRequest from a Java Servlet and write it out to a file using all NIO? Is it even worth trying? Will it be any faster reading from a normal java.io stream and writing to a java.nio Channel or do they both really need to be pure NIO to see a benefit? Thanks.
EDIT:
So I just did a quick and dirty benchmark, reading a file from one disk and writing to a different disk (so I'm actually testing the code and not the disk).
Averages:
InputStream -> OutputStream : 321 ms.
FileChannel -> FileChannel : 3 ms.
InputStream -> FileChannel : 600 ms.
I actually got worse performance trying to use a hybrid java.io -> java.nio. The nio->nio was faster by A LOT, but I'm stuck with the Servlet InputStream.