webservice以inputstream的形式返回一个mime文件,其中包含以下内容。我使用java apache httpclient发出请求:
MIME-Version:1.0
Content-Type:multipart/mixed;
boundary="----=_Part_58_1750763977.1605815692305"
------=_Part_58_1750763977.1605815692305
Content-Type: application/octet-stream; name=preview.pdf
Content-ID: response-1
Content-Disposition: attachment; filename=preview.pdf
%PDF-1.7
[...]
------=_Part_67_626667127.1605818243111
Content-Type: application/octet-stream; name=thumbnail.jpg
Content-ID: response-2
Content-Disposition: attachment; filename=thumbnail.jpg
------=_Part_58_1750763977.1605815692305
Content-Type: application/octet-stream; name=report.xml
Content-ID: response-3
Content-Disposition: attachment; filename=report.xml
现在如何将这些块转换为单个文件?我尝试了javax.mail和mime文件,但没有成功。
1条答案
按热度按时间v09wglhw1#
我成功地将邮件解析为mime,并将附件另存为文件:
通过使用