Reading input stream byte array from mime body part takes 11 minutes for 25MB file.
When viewing single email, I am reading input stream byte array from MimeBodyPart, but it takes 11 minutes to read 25MB file with java mail API. How can I speed up reading input stream byte array from MimeBodyPart?
Below is the code which I am using to read,
if (message.isMimeType("multipart/*")) {
// //System.out.println("first if");
// content may contain attachments
Multipart multiPart = (Multipart) message.getContent();
int numberOfParts = multiPart.getCount();
for (int partCount = 0; partCount < numberOfParts; partCount++) {
MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(partCount);
if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
// this part is attachment
String fileName = part.getFileName();
//final File file = new File(fileName);
String[] FileType = part.getContentType().split("\\s");
byte[] byteArray = part.getInputStream().readAllBytes();// Here it takes 11min
}}}