title: Why is java's ImageIO.read not reading my URL
body: <p>I am trying to read an image using <code>ImageIO.read(url)</code> but the method returns null. I followed suggestions <a href="https://stackoverflow.com/questions/9943962/imageio-read-returns-null-with-no-errors">here</a> but it doesn't work.
  There is no exception thrown, there isn't any useful information it spits out to figure out why the read failed. The method signature in the javadoc says &quot;If no registered ImageReader claims to be able to read the stream, null is returned.&quot;</p>
  <p>I tried to register my own ImageReader with jpg, but no luck with that as well. Any ideas on how to debug what is wrong with the image? It opens fine on my browser and <code>curl -v &lt;url&gt;</code> on it also looks good.</p>
  <pre><code>URL url = new URL(&quot;&quot;); //input String URL here
  InputStream istream = null;
  try {
          istream = url.openStream();
      } catch (IOException e) {
          throw new IIOException(&quot;Can't get input stream from URL!&quot;, e);
      }
  Iterator readers = ImageIO.getImageReadersByFormatName(&quot;jpg&quot;);
  ImageReader reader = (ImageReader)readers.next();
  ImageInputStream iis = ImageIO.createImageInputStream(istream);
  BufferedImage image = ImageIO.read(iis);
  </code></pre>
  <p>image returns null</p>