question: public static BufferedImage readImageFromYUVorGray ( InputStream in ) throws IOException { BufferedImage img = ( in instanceof ImageInputStream ) ? ImageIO . read ( ( ImageInputStream ) in ) : ImageIO . read ( in ) ; return img ; }
target:  Reads a JPEG image from the provided InputStream. The image data must be in the YUV or the Gray color space. <p> Use this method, if you have already determined that the input stream contains a YUV or Gray JPEG image.