From d8a757faaf47356dd950e9a416f9f7bedd50f002 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 29 Jul 2010 22:17:35 +0000 Subject: [PATCH] Try to avoid a bunch of reallocations as we grow the temporary output stream by defining its size if we can get it --- src/com/fsck/k9/mail/internet/MimeUtility.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/fsck/k9/mail/internet/MimeUtility.java b/src/com/fsck/k9/mail/internet/MimeUtility.java index 68bd5ce35..d114040d3 100644 --- a/src/com/fsck/k9/mail/internet/MimeUtility.java +++ b/src/com/fsck/k9/mail/internet/MimeUtility.java @@ -385,8 +385,8 @@ public class MimeUtility * Now we read the part into a buffer for further processing. Because * the stream is now wrapped we'll remove any transfer encoding at this point. */ - ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = part.getBody().getInputStream(); + ByteArrayOutputStream out = new ByteArrayOutputStream(in.available()); IOUtils.copy(in, out); in.close(); in = null; // we want all of our memory back, and close might not release