public static BufferedImage readImageFromYUVorGray(InputStream in) throws IOException {
  BufferedImage img=(in instanceof ImageInputStream) ? ImageIO.read((ImageInputStream)in) : ImageIO.read(in);
  return img;
}

public static BufferedImage readImageFromYUVorGray ( InputStream in ) throws IOException { BufferedImage img = ( in instanceof ImageInputStream ) ? ImageIO . read ( ( ImageInputStream ) in ) : ImageIO . read ( in ) ; return img ; }
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 .
