title: Why can't I parse a javamail attachment using toString?
body: <p>It seems to me the snippet below should work, but "mp.getBodyPart(1).getContent().toString()" returns</p>
  
  <blockquote>
    <p>com.sun.mail.util.BASE64DecoderStream@44b07df8</p>
  </blockquote>
  
  <p>instead of the contents of the attachment.</p>
  
  <pre><code>public class GMailParser {
      public String getParsedMessage(Message message) throws Exception {
          try {
              Multipart mp = (Multipart) message.getContent();
              String s = mp.getBodyPart(1).getContent().toString();
              if (s.contains("pattern 1")) {
                  return "return 1";
              } else if (s.contains("pattern 2")) {
                  return "return 2";
              }
              ...
  </code></pre>