我正在编写一个Java程序,用于从POP3电子邮件中下载附件.最初,我通过获取MimePart的输入流(如果其内容类型经过验证)来实现此目的.然后,我可以简单地通过FileOutputStream将输入流写入本地文件中.
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.
在互联网上搜索后,我发现该文件已被uuencoded.然后,我试图找到是否有用于解码它的标准库,但似乎运气不佳.因此,我想知道是否有任何标准/常规方法可以对其进行解码并获取附件?非常感谢.
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.
推荐答案是的," Java™EE 7规范API "支持使用uuencode进行编码和解码.
Yes, the "Java(TM) EE 7 Specification APIs" supports encoding and decoding with uuencode.
请参见 MimeUtility.decode() :
此外,还支持"uuencode".
In addition, "uuencode" is also supported.
更多推荐
Java是否有用于uudecoding的任何标准机制?
发布评论