The main difference is how you process the file, as you noticed yourself with the factory class.
The streaming API is not stored on disk when an input stream is received. In the end, you can process the file faster (with a cost in temporary memory) ... but the idea is to avoid saving the binary disk to disk if you really do not want / need it.
After that, you can save the data to disk, of course, using a buffer stream, a byte array, or the like.
EDIT: a handler when opening a stream (fileItemStreamElement. OpenStream ()) is a normal instance of InputStream. So, the answer to your question βwhat if it is a large fileβ looks like this. Memory problems with InputStream in Java
EDIT: The streaming API should not save to disk or store in memory. It just provides a stream that you can read to copy the file to where you want. This is a way to avoid a temporary directory and also not allocate enough memory to store the file. This should be faster, at least because it is not copied twice, once from the browser to disk / memory, and then again from disk / memory to where you saved it.
source share