Is ImageIO.write buffered?

Should i write

BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file));
ImageIO.write(im, "JPEG", os);

instead

ImageIO.write(im, "JPEG", file);

those. are imageIO file operations by default or not?

Thank!

+3
source share
3 answers

If you go in File, the base implementation will write directly in RandomAccessFile(created in mode "rw"), so there will be no buffering. In particular, FileImageOutputStreamwill be used as ImageOutputStream.

+1
source

I believe this depends on the particular implementation IIORegistry, which I believe is system dependent.

I would expect it to be buffered, but I suppose you could make the first option completely confident.

0
source

BufferedOutputStream ( 1, ).

ImageIo.write . , . File .

0
source

Source: https://habr.com/ru/post/1753715/


All Articles