if (stream == null) throw new IllegalArgumentException("null argument");
  public static BufferedImage read(ImageInputStream stream)    throws IOException  {    Iterator providers = getRegistry().getServiceProviders(ImageReaderSpi.class, true);    while (providers.hasNext())      {        ImageReaderSpi spi = (ImageReaderSpi) providers.next();        if (spi.canDecodeInput(stream))          {            ImageReader reader = spi.createReaderInstance();            reader.setInput(stream);            return reader.read(0, null);          }      }    return null;  }