I have a servlet based application that is serving images from files stored locally. I have added logic that will allow the application to load the image file to a Buffered
No, you must write the file in memory or to a temporary file.
The reason is that it's impossible to predict how the JPEG encoding will affect file size.
Also, it's not good enough to "guess" at the file size; the Content-Length header has to be spot-on.
Content-Length