
我终于有了解决方法。
我将使用javax邮件MimeMultipart。
ByteArrayDataSource datasource = new ByteArrayDataSource(in, "multipart/form-data"); MimeMultipart multipart = new MimeMultipart(datasource); int count = multipart.getCount(); log.debug("count " + count); for (int i = 0; i < count; i++) { BodyPart bodyPart = multipart.getBodyPart(i); if (bodyPart.isMimeType("text/plain")) { log.info("text/plain " + bodyPart.getContentType()); processTextData(bodyPart.getContent()); } else if (bodyPart.isMimeType("application/octet-stream")) { log.info("application/octet-stream " + bodyPart.getContentType()); processBinaryData(bodyPart.getInputStream())); } else { log.warn("default " + bodyPart.getContentType()); } }请让我知道是否还有其他标准解决方案。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)