james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1063904 [2/2] - in /james/mime4j/trunk: ./ benchmark/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/parser/ dom/src/main/java/org/apache/james/mime4j/dom/ dom/src/main/java/org/apache/james/mime4j/field/ ...
Date Wed, 26 Jan 2011 22:38:39 GMT
Modified: james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java?rev=1063904&r1=1063903&r2=1063904&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
(original)
+++ james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
Wed Jan 26 22:38:38 2011
@@ -27,6 +27,7 @@ import org.apache.james.mime4j.field.add
 import org.apache.james.mime4j.field.address.ParseException;
 import org.apache.james.mime4j.message.BodyFactory;
 import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MimeWriter;
 
 /**
  * This example generates a message very similar to the one from RFC 5322
@@ -42,13 +43,13 @@ public class TextPlainMessage {
 
         // Date and From are required fields
         message.setDate(new Date());
-        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.DEFAULT.parseMailbox("John Doe <jdoe@machine.example>"));
 
         // Message-ID should be present
         message.createMessageId("machine.example");
 
         // set some optional fields
-        message.setTo(AddressBuilder.parseMailbox("Mary Smith <mary@example.net>"));
+        message.setTo(AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>"));
         message.setSubject("Saying Hello");
 
         // 3) set a text body
@@ -62,7 +63,7 @@ public class TextPlainMessage {
 
         // 4) print message to standard output
 
-        message.writeTo(System.out);
+        MimeWriter.DEFAULT.writeMessage(message, System.out);
 
         // 5) message is no longer needed and should be disposed of
 

Modified: james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java?rev=1063904&r1=1063903&r2=1063904&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
(original)
+++ james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
Wed Jan 26 22:38:38 2011
@@ -35,6 +35,7 @@ import org.apache.james.mime4j.message.B
 import org.apache.james.mime4j.message.BodyPart;
 import org.apache.james.mime4j.message.MessageImpl;
 import org.apache.james.mime4j.message.MimeBuilder;
+import org.apache.james.mime4j.message.MimeWriter;
 import org.apache.james.mime4j.message.MultipartImpl;
 import org.apache.james.mime4j.storage.DefaultStorageProvider;
 import org.apache.james.mime4j.storage.StorageProvider;
@@ -65,7 +66,7 @@ public class TransformMessage {
 
         // Print transformed message.
         System.out.println("\n\nTransformed message:\n--------------------\n");
-        transformed.writeTo(System.out);
+        MimeWriter.DEFAULT.writeMessage(transformed, System.out);
 
         // Messages should be disposed of when they are no longer needed.
         // Disposing of a message also disposes of all child elements (e.g. body
@@ -75,7 +76,7 @@ public class TransformMessage {
         // Print original message to illustrate that it was not affected by the
         // transformation.
         System.out.println("\n\nOriginal template:\n------------------\n");
-        template.writeTo(System.out);
+        MimeWriter.DEFAULT.writeMessage(template, System.out);
 
         // Original message is no longer needed.
         template.dispose();
@@ -91,7 +92,7 @@ public class TransformMessage {
     private static Message transform(Message original) throws IOException, ParseException
{
         // Create a copy of the template. The copy can be modified without
         // affecting the original.
-        Message message = MimeBuilder.copy(original);
+        Message message = MimeBuilder.DEFAULT.copy(original);
 
         // In this example we know we have a multipart message. Use
         // Message#isMultipart() if uncertain.
@@ -118,7 +119,7 @@ public class TransformMessage {
         message.createMessageId(HOSTNAME);
         message.setSubject("Transformed message");
         message.setDate(new Date());
-        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.DEFAULT.parseMailbox("John Doe <jdoe@machine.example>"));
 
         return message;
     }

Modified: james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=1063904&r1=1063903&r2=1063904&view=diff
==============================================================================
--- james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
(original)
+++ james/mime4j/trunk/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
Wed Jan 26 22:38:38 2011
@@ -315,7 +315,7 @@ public class MessageTree extends JPanel 
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < list.size(); i++) {
                     Mailbox mb = list.get(i);
-                    sb.append(AddressFormatter.format(mb, false) + "\n");
+                    sb.append(AddressFormatter.DEFAULT.format(mb, false) + "\n");
                 }
                 textView.setText(sb.toString());
 
@@ -366,7 +366,7 @@ public class MessageTree extends JPanel 
     public static void main(String[] args) {
         try {
 
-            final Message message = MimeBuilder.parse(new FileInputStream(args[0]));
+            final Message message = MimeBuilder.DEFAULT.parse(new FileInputStream(args[0]));
 
             javax.swing.SwingUtilities.invokeLater(new Runnable() {
                 public void run() {



Mime
View raw message