use of com.sun.mail.util.CRLFOutputStream in project nhin-d by DirectProject.
the class DefaultSmtpAgent method canonicalizeMessage.
/**
* Create a canonicalized version of a given mime message
*
* @param mimeMessage
* the message to canonicalize
* @return a mime message in the canonical form
* @throws IOException
* @throws MessagingException
*/
protected MimeMessage canonicalizeMessage(MimeMessage mimeMessage) throws IOException, MessagingException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
CRLFOutputStream crlfOutputStream = new CRLFOutputStream(byteArrayOutputStream);
mimeMessage.writeTo(crlfOutputStream);
return new MimeMessage((Session) null, new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
}
Aggregations