Loading src/com/fsck/k9/mail/internet/BinaryTempFileBody.java +12 −6 Original line number Diff line number Diff line Loading @@ -45,13 +45,16 @@ public class BinaryTempFileBody implements Body { public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream in = getInputStream(); try { Base64OutputStream base64Out = new Base64OutputStream(out); try { IOUtils.copy(in, base64Out); } finally { base64Out.close(); } mFile.delete(); } finally { in.close(); } } class BinaryTempFileBodyInputStream extends FilterInputStream { Loading @@ -61,8 +64,11 @@ public class BinaryTempFileBody implements Body { @Override public void close() throws IOException { try { super.close(); } finally { mFile.delete(); } } } } src/com/fsck/k9/mail/internet/MimeUtility.java +12 −1 Original line number Diff line number Diff line Loading @@ -1061,7 +1061,18 @@ public class MimeUtility { * the stream is now wrapped we'll remove any transfer encoding at this point. */ InputStream in = part.getBody().getInputStream(); return readToString(in, charset); try { String text = readToString(in, charset); // Replace the body with a TextBody that already contains the decoded text part.setBody(new TextBody(text)); return text; } finally { try { in.close(); } catch (IOException e) { /* Ignore */ } } } } Loading Loading
src/com/fsck/k9/mail/internet/BinaryTempFileBody.java +12 −6 Original line number Diff line number Diff line Loading @@ -45,13 +45,16 @@ public class BinaryTempFileBody implements Body { public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream in = getInputStream(); try { Base64OutputStream base64Out = new Base64OutputStream(out); try { IOUtils.copy(in, base64Out); } finally { base64Out.close(); } mFile.delete(); } finally { in.close(); } } class BinaryTempFileBodyInputStream extends FilterInputStream { Loading @@ -61,8 +64,11 @@ public class BinaryTempFileBody implements Body { @Override public void close() throws IOException { try { super.close(); } finally { mFile.delete(); } } } }
src/com/fsck/k9/mail/internet/MimeUtility.java +12 −1 Original line number Diff line number Diff line Loading @@ -1061,7 +1061,18 @@ public class MimeUtility { * the stream is now wrapped we'll remove any transfer encoding at this point. */ InputStream in = part.getBody().getInputStream(); return readToString(in, charset); try { String text = readToString(in, charset); // Replace the body with a TextBody that already contains the decoded text part.setBody(new TextBody(text)); return text; } finally { try { in.close(); } catch (IOException e) { /* Ignore */ } } } } Loading