title: Java get image extension/type using BufferedImage from URL
body: <p>I am familiar with <a href="http://docs.oracle.com/javase/tutorial/2d/images/" rel="noreferrer">working with images</a>. I <a href="http://docs.oracle.com/javase/tutorial/2d/images/loadimage.html" rel="noreferrer">retrieve/read an image from a URL</a>, where the URL does not have a file extension. Then I wish to <a href="http://docs.oracle.com/javase/tutorial/2d/images/saveimage.html" rel="noreferrer">write/save the image</a> to the local storage, but I have to specify the image file extension (i.e. JPG, PNG, etc.), which I cannot retrieve its extension through the BufferedImage.</p>
  
  <p>Could one please point out how it can be done?
  Any other method will do.</p>