alanlo alanlo - 1 year ago 79
Java Question

Does Java has any standard mechanism for uudecoding?

I was writing a Java program to download attachments from POP3 email. Originally I do this with getting an input stream of a MimePart if its content type is validated. And then I can simply write the input stream into a local file through a FileOutputStream.

However, one thing I encountered is that, after I received an email with an attached file as its only content and access it, the mail (of type Message) only consists of a single part, which is of type text/plain. And its content consists of massive random-looking character.

After searching through the internet I found that the file is uuencoded. Then I tried to find if there is any standard library for decoding it but seems I ran out of luck. So I would like to know is there any standard/ usual ways to decode it and obtain the attached file? Thanks a lot.

Answer Source

Yes, the "Java(TM) EE 7 Specification APIs" supports encoding and decoding with uuencode.

See MimeUtility.decode():

In addition, "uuencode" is also supported.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download