question: void writeWithThumbs ( ImageOutputStream ios , List thumbnails , JPEGImageWriter writer ) throws IOException { if ( thumbnails != null ) { JFIFExtensionMarkerSegment jfxx = null ; if ( thumbnails . size ( ) == 1 ) { if ( ! extSegments . isEmpty ( ) ) { jfxx = ( JFIFExtensionMarkerSegment ) extSegments . get ( 0 ) ; } writeThumb ( ios , ( BufferedImage ) thumbnails . get ( 0 ) , jfxx , 0 , true , writer ) ; } else { write ( ios , writer ) ; for ( int i = 0 ; i < thumbnails . size ( ) ; i ++ ) { jfxx = null ; if ( i < extSegments . size ( ) ) { jfxx = ( JFIFExtensionMarkerSegment ) extSegments . get ( i ) ; } writeThumb ( ios , ( BufferedImage ) thumbnails . get ( i ) , jfxx , i , false , writer ) ; } } } else { write ( ios , writer ) ; } }
target:  Write out this JFIF Marker Segment, including a thumbnail or appending a series of JFXX Marker Segments, as appropriate. Warnings and progress reports are sent to the writer argument. The list of thumbnails is matched to the list of JFXX extension segments, if any, in order to determine how to encode the thumbnails.  If there are more thumbnails than metadata segments, default encoding is used for the extra thumbnails.