question: public void write ( BufferedImage bimg , OutputStream os ) throws IOException { ImageWriter writer = null ; ImageOutputStream ios = null ; try { writer = lookupImageWriterForFormat ( imageFormat ) ; ios = ImageIO . createImageOutputStream ( os ) ; writer . setOutput ( ios ) ; ImageWriteParam iwparam = getImageWriteParameters ( writer ) ; writer . write ( null , new IIOImage ( bimg , null , null ) , iwparam ) ; } finally { if ( ios != null ) { try { ios . flush ( ) ; } catch ( IOException e ) { } try { ios . close ( ) ; } catch ( IOException e ) { } } if ( writer != null ) { writer . dispose ( ) ; } } }
target:  Writes the image out to the target file, creating the file if necessary, or overwriting if it already exists.