Repository: james-project Updated Branches: refs/heads/master 8f197a4df -> 2618edcd5
JAMES-2285 Expose a method helping comparing MimeMessage as strings Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f4ad9c79 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f4ad9c79 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f4ad9c79 Branch: refs/heads/master Commit: f4ad9c792ccd3b5db0ea349ab046e56e9f498cad Parents: 1a9d80d Author: benwa <btell...@linagora.com> Authored: Thu Jan 11 16:10:18 2018 +0700 Committer: benwa <btell...@linagora.com> Committed: Mon Jan 15 17:04:03 2018 +0700 ---------------------------------------------------------------------- .../org/apache/james/core/builder/MimeMessageBuilder.java | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/f4ad9c79/core/src/main/java/org/apache/james/core/builder/MimeMessageBuilder.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/james/core/builder/MimeMessageBuilder.java b/core/src/main/java/org/apache/james/core/builder/MimeMessageBuilder.java index 42b845a..4c9cc79 100644 --- a/core/src/main/java/org/apache/james/core/builder/MimeMessageBuilder.java +++ b/core/src/main/java/org/apache/james/core/builder/MimeMessageBuilder.java @@ -20,6 +20,7 @@ package org.apache.james.core.builder; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -51,6 +52,12 @@ import com.google.common.collect.ImmutableList; public class MimeMessageBuilder { + public static String asString(MimeMessage mimeMessage) throws Exception { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + mimeMessage.writeTo(byteArrayOutputStream); + return new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8); + } + public static class Header { private final String name; private final String value; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org