title: Base64 InputStream to String
body: <p>I have been trying to get an input stream reading a file, which isa plain text and has embeded some images and another files in <code>base64</code> and write it again in a String. But keeping the encoding, I mean, I want to have in the String something like:</p>
  
  <pre><code>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf
  IiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7
  </code></pre>
  
  <p>I have been trying with the classes <code>Base64InputStream</code> and more from packages as <code>org.apache.commons.codec</code> but I just can not fiugure it out. Any kind of help would be really appreciated. Thanks in advance!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Piece of code using a reader:</p>
  
  <pre><code> BufferedReader br= new BufferedReader(new InputStreamReader(bodyPart.getInputStream()));
                          StringBuilder sb = new StringBuilder();
                          String line;
                          while ((line = br.readLine()) != null) {
                              sb.append(line);
                          }
                          br.close();
  </code></pre>
  
  <p>Getting as a result something like: <code>.DIC;ÿÛC;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ÿÀ@@"ÿÄ</code> </p>