Should I write
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file));
ImageIO.write(im, "JPEG", os);
instead of
ImageIO.write(im, "JPEG", file);
I.e. are ImageIO file operations buffered by default or not?
Thanks!
If you pass in a File, the underlying implementation will write directly to a RandomAccessFile (created in "rw" mode), so no buffering. Specifically, a FileImageOutputStream will be used as the ImageOutputStream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With