title: How can I turn an ImageIcon back into a blob?
body: <p>I've stored a Blob (PNG file) into the database like so:</p>
  
  <pre><code>File file = new File( "image.png" );
  FileInputStream fis = new FileInputStream( file );
  statement.setBinaryStream( 1, fis, (int) file.length() );
  </code></pre>
  
  <p>Currently I use this process to get the Blob image from the DB and convert it back into an image for use: </p>
  
  <pre><code>Blob blob = results.getBlob( 1 );
  ImageIcon imageIcon = new ImageIcon( blob.getBytes( 1L, (int) blob.length() ) );
  </code></pre>
  
  <p>However, i need a method to put the image back into the database (after i've altered it) from the ImageIcon without creating a file, storing it to the disk then reading it back in with the FileInputSteam.</p>
  
  <p><em>edit for clarity</em>
  Well, say i've got that image stored inside a Label as an ImageIcon. The only way i know how to put that into the database is to read from a FileInputStream, but that would involve pointlessly making a file of the image. So how would i read the Image from ImageIcon back out as a BinaryStream or Blob back to the database? </p>