title: Display image with base64 String in html?
body: <p>here is my java code that construct the base64 String from image. Then place the base64 String html, to view
  the constructed image, but image  is not constructed somehow</p>
  
  <pre><code>public void getBase64String() throws FileNotFoundException {
      FileInputStream itStrm = new FileInputStream(
      "E:\\image\\56255254-flower.jpg");//image is lying at http://danny.oz.au/travel/mongolia/p/56255254-flower.jpg
      String str = itStrm.toString();
      byte[] b3 = str.getBytes();
      String base64String = new sun.misc.BASE64Encoder().encode(b3);
      //output of base64String is amF2YS5pby5GaWxlSW5wdXRTdHJlYW1AMTdlMDYwMA==
    }
  </code></pre>
  
  <p><strong>Now in html page i placed the output of base64String in img tag to view the image.But image does not shows up
  (instead it display the cross image icon). I am not getting image is not displayed from base64 String below?</strong></p>
  
  <pre><code>      &lt;HTML&gt;
        &lt;BODY&gt;
             &lt;img    src="data:image/jpeg;base64,amF2YS5pby5GaWxlSW5wdXRTdHJlYW1AMTdlMDYwMA=="/&gt;
  
       &lt;/BODY&gt;
       &lt;/HTML&gt;
  </code></pre>
  
  <p><strong>EDIT:-</strong> Thanks Folks, i used byte[] bytes = IOUtils.toByteArray(is);. It worked for me!!</p>