title: Converting decode utf-8 string to file
body: <p>I am trying to save image which I am receiving from android device. From Android getting utf-8 encode string and below is the code I am using to save.</p>
  
  <pre><code>String test = java.net.URLDecoder.decode(image_base64, "UTF-8");
  byte[] data = Base64.decodeBase64(test.getBytes());
  FileOutputStream stream = null;
  
  try {
      stream = new FileOutputStream("/var/lib/easy-tomcat7/webapps/test/test1.bmp");
      stream.write(data);
      stream.flush();
      test1 += "success";
  }
  catch (IOException e)
  {
      test1 = "failuare";
      e.getMessage();
  }
  finally
  {
      test1 += "finally";
      stream.close();
  }
  </code></pre>
  
  <p>File is creating but the it is corrupted. I did lot of research on this but not getting why it is happening. Please help me to solve this issue. </p>