wrappedOut = new QuotedPrintableOutputStream(out, false); } else if (MimeUtil.ENC_BASE64.equals(encoding)) { wrappedOut = new Base64OutputStream(out); } else { throw new RuntimeException("Target encoding not supported: " + encoding);
@Override public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream in = getInputStream(); try { boolean closeStream = false; if (MimeUtil.isBase64Encoding(mEncoding)) { out = new Base64OutputStream(out); closeStream = true; } else if (MimeUtil.isQuotedPrintableEncoded(mEncoding)){ out = new QuotedPrintableOutputStream(out, false); closeStream = true; } try { IOUtils.copy(in, out); } finally { if (closeStream) { out.close(); } } } finally { in.close(); } }
@Override public void writeTo(OutputStream outputStream) throws IOException, MessagingException { InputStream in = getInputStream(); if (in != null) { Base64OutputStream base64Out = new Base64OutputStream(outputStream); IOUtils.copy(in, base64Out); base64Out.close(); } else { Log.w(TAG, "input stream is null"); } } }