use of com.fsck.k9.mail.internet.BinaryTempFileBody in project k-9 by k9mail.
the class MessageTest method binaryBodyPart.
private MimeBodyPart binaryBodyPart() throws IOException, MessagingException {
String encodedTestString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789+/\r\n";
BinaryTempFileBody tempFileBody = new BinaryTempFileBody(MimeUtil.ENC_BASE64);
InputStream in = new ByteArrayInputStream(encodedTestString.getBytes("UTF-8"));
OutputStream out = tempFileBody.getOutputStream();
try {
IOUtils.copy(in, out);
} finally {
out.close();
}
MimeBodyPart bodyPart = new MimeBodyPart(tempFileBody, "application/octet-stream");
bodyPart.setEncoding(MimeUtil.ENC_BASE64);
return bodyPart;
}
Aggregations