james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1127006 - in /james/mime4j/trunk: core/src/main/java/org/apache/james/mime4j/stream/ dom/src/main/java/org/apache/james/mime4j/field/ dom/src/main/java/org/apache/james/mime4j/message/
Date Tue, 24 May 2011 12:35:11 GMT
Author: olegk
Date: Tue May 24 12:35:10 2011
New Revision: 1127006

URL: http://svn.apache.org/viewvc?rev=1127006&view=rev
Log:
Follow-up to MIME4J-116: FieldParser interface changed to take Field as an input parameter.
This enables more efficient parser implementations that can make use of RawField data without
having to make an intermediate copy of the field body

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/AbstractEntity.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldParser.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDescriptionFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentIdFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLengthFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLocationFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentMD5FieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MimeVersionFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/UnstructuredFieldImpl.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/AbstractEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/AbstractEntity.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/AbstractEntity.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/AbstractEntity.java
Tue May 24 12:35:10 2011
@@ -150,8 +150,7 @@ abstract class AbstractEntity implements
                     monitor(Event.OBSOLETE_HEADER);
                 }
                 if (fieldParser != null) {
-                    field = fieldParser.parse(
-                            rawfield.getName(), rawfield.getBody(), rawfield.getRaw(), monitor);
+                    field = fieldParser.parse(rawfield, monitor);
                 } else {
                     field = rawfield;
                 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldParser.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldParser.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldParser.java
Tue May 24 12:35:10 2011
@@ -20,10 +20,9 @@
 package org.apache.james.mime4j.stream;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
-import org.apache.james.mime4j.util.ByteSequence;
 
 public interface FieldParser<T extends Field> {
     
-    T parse(String name, String body, ByteSequence raw, DecodeMonitor monitor);
+    T parse(Field rawField, DecodeMonitor monitor);
     
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
Tue May 24 12:35:10 2011
@@ -24,6 +24,7 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.field.AddressListField;
 import org.apache.james.mime4j.field.address.AddressBuilder;
 import org.apache.james.mime4j.field.address.ParseException;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -75,9 +76,10 @@ public class AddressListFieldImpl extend
     }
 
     public static final FieldParser<AddressListField> PARSER = new FieldParser<AddressListField>()
{
-        public AddressListField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new AddressListFieldImpl(name, body, raw, monitor);
+        
+        public AddressListField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new AddressListFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDescriptionFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDescriptionFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDescriptionFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDescriptionFieldImpl.java
Tue May 24 12:35:10 2011
@@ -21,6 +21,7 @@ package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ContentDescriptionField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -54,10 +55,11 @@ public class ContentDescriptionFieldImpl
     }
 
     public static final FieldParser<ContentDescriptionField> PARSER = new FieldParser<ContentDescriptionField>()
{
-        public ContentDescriptionField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentDescriptionFieldImpl(name, body, raw, monitor);
+        
+        public ContentDescriptionField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentDescriptionFieldImpl(rawField.getName(), rawField.getBody(),
rawField.getRaw(), monitor);
         }
+        
     };
 
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
Tue May 24 12:35:10 2011
@@ -33,6 +33,7 @@ import org.apache.james.mime4j.field.con
 import org.apache.james.mime4j.field.contentdisposition.parser.ParseException;
 import org.apache.james.mime4j.field.contentdisposition.parser.TokenMgrError;
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -247,9 +248,10 @@ public class ContentDispositionFieldImpl
     }
 
     public static final FieldParser<ContentDispositionField> PARSER = new FieldParser<ContentDispositionField>()
{
-        public ContentDispositionField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentDispositionFieldImpl(name, body, raw, monitor);
+        
+        public ContentDispositionField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentDispositionFieldImpl(rawField.getName(), rawField.getBody(),
rawField.getRaw(), monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentIdFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentIdFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentIdFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentIdFieldImpl.java
Tue May 24 12:35:10 2011
@@ -21,6 +21,7 @@ package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ContentIdField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -54,10 +55,11 @@ public class ContentIdFieldImpl extends 
     }
 
     public static final FieldParser<ContentIdField> PARSER = new FieldParser<ContentIdField>()
{
-        public ContentIdField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentIdFieldImpl(name, body, raw, monitor);
+        
+        public ContentIdField parse(final Field rawField, final DecodeMonitor monitor) {
+            return new ContentIdFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLanguageFieldImpl.java
Tue May 24 12:35:10 2011
@@ -27,6 +27,7 @@ import org.apache.james.mime4j.codec.Dec
 import org.apache.james.mime4j.dom.field.ContentLanguageField;
 import org.apache.james.mime4j.field.language.parser.ContentLanguageParser;
 import org.apache.james.mime4j.field.language.parser.ParseException;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -72,10 +73,11 @@ public class ContentLanguageFieldImpl ex
     }
 
     public static final FieldParser<ContentLanguageField> PARSER = new FieldParser<ContentLanguageField>()
{
-        public ContentLanguageField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentLanguageFieldImpl(name, body, raw, monitor);
+        
+        public ContentLanguageField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentLanguageFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLengthFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLengthFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLengthFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLengthFieldImpl.java
Tue May 24 12:35:10 2011
@@ -21,6 +21,7 @@ package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ContentLengthField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -69,9 +70,10 @@ public class ContentLengthFieldImpl exte
     }
 
     public static final FieldParser<ContentLengthField> PARSER = new FieldParser<ContentLengthField>()
{
-        public ContentLengthField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentLengthFieldImpl(name, body, raw, monitor);
+        
+        public ContentLengthField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentLengthFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLocationFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLocationFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLocationFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentLocationFieldImpl.java
Tue May 24 12:35:10 2011
@@ -25,6 +25,7 @@ import org.apache.james.mime4j.codec.Dec
 import org.apache.james.mime4j.dom.field.ContentLocationField;
 import org.apache.james.mime4j.field.structured.parser.ParseException;
 import org.apache.james.mime4j.field.structured.parser.StructuredFieldParser;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -78,10 +79,11 @@ public class ContentLocationFieldImpl ex
     }
 
     public static final FieldParser<ContentLocationField> PARSER = new FieldParser<ContentLocationField>()
{
-        public ContentLocationField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentLocationFieldImpl(name, body, raw, monitor);
+        
+        public ContentLocationField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentLocationFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentMD5FieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentMD5FieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentMD5FieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentMD5FieldImpl.java
Tue May 24 12:35:10 2011
@@ -21,6 +21,7 @@ package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ContentMD5Field;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -54,10 +55,11 @@ public class ContentMD5FieldImpl extends
     }
 
     public static final FieldParser<ContentMD5Field> PARSER = new FieldParser<ContentMD5Field>()
{
-        public ContentMD5Field parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentMD5FieldImpl(name, body, raw, monitor);
+        
+        public ContentMD5Field parse(final Field rawField, final DecodeMonitor monitor) {
+            return new ContentMD5FieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldImpl.java
Tue May 24 12:35:10 2011
@@ -23,6 +23,7 @@ import java.util.Locale;
 
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ContentTransferEncodingField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.MimeUtil;
@@ -74,9 +75,10 @@ public class ContentTransferEncodingFiel
     }
 
     public static final FieldParser<ContentTransferEncodingField> PARSER = new FieldParser<ContentTransferEncodingField>()
{
-        public ContentTransferEncodingField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentTransferEncodingFieldImpl(name, body, raw, monitor);
+        
+        public ContentTransferEncodingField parse(final Field rawField, final DecodeMonitor
monitor) {
+            return new ContentTransferEncodingFieldImpl(rawField.getName(), rawField.getBody(),
rawField.getRaw(), monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
Tue May 24 12:35:10 2011
@@ -30,6 +30,7 @@ import org.apache.james.mime4j.dom.field
 import org.apache.james.mime4j.field.contenttype.parser.ContentTypeParser;
 import org.apache.james.mime4j.field.contenttype.parser.ParseException;
 import org.apache.james.mime4j.field.contenttype.parser.TokenMgrError;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -223,9 +224,10 @@ public class ContentTypeFieldImpl extend
     }
 
     public static final FieldParser<ContentTypeField> PARSER = new FieldParser<ContentTypeField>()
{
-        public ContentTypeField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new ContentTypeFieldImpl(name, body, raw, monitor);
+        
+        public ContentTypeField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new ContentTypeFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
Tue May 24 12:35:10 2011
@@ -27,6 +27,7 @@ import org.apache.james.mime4j.dom.field
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
 import org.apache.james.mime4j.field.datetime.parser.ParseException;
 import org.apache.james.mime4j.field.datetime.parser.TokenMgrError;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -80,9 +81,10 @@ public class DateTimeFieldImpl extends A
     }
 
     public static final FieldParser<DateTimeField> PARSER = new FieldParser<DateTimeField>()
{
-        public DateTimeField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new DateTimeFieldImpl(name, body, raw, monitor);
+        
+        public DateTimeField parse(final Field rawField, final DecodeMonitor monitor) {
+            return new DateTimeFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
Tue May 24 12:35:10 2011
@@ -64,24 +64,7 @@ public class DefaultFieldParser extends 
             final ByteSequence raw, 
             final DecodeMonitor monitor) throws MimeException {
         Field rawField = RawFieldParser.DEFAULT.parseField(raw);
-        return PARSER.parse(rawField.getName(), rawField.getBody(), raw, monitor);
-    }
-
-    /**
-     * Parses the given <code>RawField</code> and returns an instance of the
-     * <code>Field</code> class. The type of the class returned depends on the
-     * field name; see {@link #parse(String)} for a table of field names and
-     * their corresponding classes.
-     * 
-     * @param rawField the raw field to parse.
-     * @param monitor a DecodeMonitor object used while parsing/decoding.
-     * @return a <code>ParsedField</code> instance.
-     * @throws MimeException if the raw string cannot be split into field name and body.
-     */
-    public static ParsedField parse(
-            final Field rawField, 
-            final DecodeMonitor monitor) throws MimeException {
-        return PARSER.parse(rawField.getName(), rawField.getBody(), rawField.getRaw(), monitor);
+        return PARSER.parse(rawField, monitor);
     }
 
     /**
@@ -112,7 +95,7 @@ public class DefaultFieldParser extends 
         RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
         // Do not retain the original raw representation as the field
         // may require folding
-        return PARSER.parse(rawField.getName(), rawField.getBody(), null, monitor);
+        return PARSER.parse(rawField, monitor);
     }
 
     public static ParsedField parse(final String rawStr) throws MimeException {

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
Tue May 24 12:35:10 2011
@@ -25,8 +25,8 @@ import java.util.Map;
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.dom.field.ParsedField;
 import org.apache.james.mime4j.dom.field.UnstructuredField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
-import org.apache.james.mime4j.util.ByteSequence;
 
 public class DelegatingFieldParser implements FieldParser<ParsedField> {
     private static final FieldParser<UnstructuredField> DEFAULT_PARSER = UnstructuredFieldImpl.PARSER;
@@ -50,8 +50,8 @@ public class DelegatingFieldParser imple
         return field;
     }
     
-    public ParsedField parse(final String name, final String body, final ByteSequence raw,
DecodeMonitor monitor) {
-        final FieldParser<? extends ParsedField> parser = getParser(name);
-        return parser.parse(name, body, raw, monitor);
+    public ParsedField parse(final Field rawField, final DecodeMonitor monitor) {
+        final FieldParser<? extends ParsedField> parser = getParser(rawField.getName());
+        return parser.parse(rawField, monitor);
     }
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java (original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/Fields.java Tue May
24 12:35:10 2011
@@ -617,8 +617,7 @@ public class Fields {
     private static <F extends ParsedField> F parse(FieldParser<F> parser,
             String fieldName, String fieldBody) {
         RawField rawField = new RawField(fieldName, fieldBody);
-        return parser.parse(rawField.getName(), rawField.getBody(), rawField.getRaw(), 
-                DecodeMonitor.SILENT);
+        return parser.parse(rawField, DecodeMonitor.SILENT);
     }
 
     private static String encodeAddresses(Iterable<? extends Address> addresses) {

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
Tue May 24 12:35:10 2011
@@ -25,6 +25,7 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.field.MailboxField;
 import org.apache.james.mime4j.field.address.AddressBuilder;
 import org.apache.james.mime4j.field.address.ParseException;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -78,9 +79,10 @@ public class MailboxFieldImpl extends Ab
     }
 
     public static final FieldParser<MailboxField> PARSER = new FieldParser<MailboxField>()
{
-        public MailboxField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new MailboxFieldImpl(name, body, raw, monitor);
+        
+        public MailboxField parse(final Field rawField, final DecodeMonitor monitor) {
+            return new MailboxFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
Tue May 24 12:35:10 2011
@@ -24,6 +24,7 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.field.MailboxListField;
 import org.apache.james.mime4j.field.address.AddressBuilder;
 import org.apache.james.mime4j.field.address.ParseException;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -74,9 +75,10 @@ public class MailboxListFieldImpl extend
     }
 
     public static final FieldParser<MailboxListField> PARSER = new FieldParser<MailboxListField>()
{
-        public MailboxListField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new MailboxListFieldImpl(name, body, raw, monitor);
+        
+        public MailboxListField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new MailboxListFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MimeVersionFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MimeVersionFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MimeVersionFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/MimeVersionFieldImpl.java
Tue May 24 12:35:10 2011
@@ -26,6 +26,7 @@ import org.apache.james.mime4j.codec.Dec
 import org.apache.james.mime4j.dom.field.MimeVersionField;
 import org.apache.james.mime4j.field.mimeversion.parser.MimeVersionParser;
 import org.apache.james.mime4j.field.mimeversion.parser.ParseException;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -90,10 +91,11 @@ public class MimeVersionFieldImpl extend
     }
 
     public static final FieldParser<MimeVersionField> PARSER = new FieldParser<MimeVersionField>()
{
-        public MimeVersionField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new MimeVersionFieldImpl(name, body, raw, monitor);
+        
+        public MimeVersionField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new MimeVersionFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
     
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/UnstructuredFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/UnstructuredFieldImpl.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/UnstructuredFieldImpl.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/field/UnstructuredFieldImpl.java
Tue May 24 12:35:10 2011
@@ -22,6 +22,7 @@ package org.apache.james.mime4j.field;
 import org.apache.james.mime4j.codec.DecodeMonitor;
 import org.apache.james.mime4j.codec.DecoderUtil;
 import org.apache.james.mime4j.dom.field.UnstructuredField;
+import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.FieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -56,9 +57,11 @@ public class UnstructuredFieldImpl exten
     }
 
     public static final FieldParser<UnstructuredField> PARSER = new FieldParser<UnstructuredField>()
{
-        public UnstructuredField parse(final String name, final String body,
-                final ByteSequence raw, DecodeMonitor monitor) {
-            return new UnstructuredFieldImpl(name, body, raw, monitor);
+        
+        public UnstructuredField parse(final Field rawField, final DecodeMonitor monitor)
{
+            return new UnstructuredFieldImpl(rawField.getName(), rawField.getBody(), rawField.getRaw(),
monitor);
         }
+        
     };
+
 }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
Tue May 24 12:35:10 2011
@@ -114,7 +114,7 @@ class EntityBuilder implements ContentHa
         if (field instanceof ParsedField) {
             parsedField = (ParsedField) field;
         } else {
-            parsedField = fieldParser.parse(field.getName(), field.getBody(), field.getRaw(),
monitor);
+            parsedField = fieldParser.parse(field, monitor);
         }
         ((Header) stack.peek()).addField(parsedField);
     }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
Tue May 24 12:35:10 2011
@@ -99,7 +99,7 @@ public class MaximalBodyDescriptor exten
             contentMD5Field = (ContentMD5Field) field;
         } else {
             contentMD5Field = ContentMD5FieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
 
@@ -108,7 +108,7 @@ public class MaximalBodyDescriptor exten
             contentLocationField = (ContentLocationField) field;
         } else {
             contentLocationField = ContentLocationFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
     
@@ -117,7 +117,7 @@ public class MaximalBodyDescriptor exten
             contentLanguageField = (ContentLanguageField) field;
         } else {
             contentLanguageField = ContentLanguageFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
 
@@ -126,7 +126,7 @@ public class MaximalBodyDescriptor exten
             contentDispositionField = (ContentDispositionField) field;
         } else {
             contentDispositionField = ContentDispositionFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
 
@@ -135,7 +135,7 @@ public class MaximalBodyDescriptor exten
             contentDescriptionField = (ContentDescriptionField) field;
         } else {
             contentDescriptionField = ContentDescriptionFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
 
@@ -144,7 +144,7 @@ public class MaximalBodyDescriptor exten
             contentIdField = (ContentIdField) field;
         } else {
             contentIdField = ContentIdFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
 
@@ -153,7 +153,7 @@ public class MaximalBodyDescriptor exten
             mimeVersionField = (MimeVersionField) field;
         } else {
             mimeVersionField = MimeVersionFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), getDecodeMonitor());
+                    field, getDecodeMonitor());
         }
     }
     

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MimeBuilder.java
Tue May 24 12:35:10 2011
@@ -219,8 +219,7 @@ public class MimeBuilder {
                 if (field instanceof ParsedField) {
                     parsedField = (ParsedField) field;
                 } else {
-                    parsedField = fieldParser.parse(
-                            field.getName(), field.getBody(), field.getRaw(), monitor);
+                    parsedField = fieldParser.parse(field, monitor);
                 }
                 header.addField(parsedField);
             }

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
Tue May 24 12:35:10 2011
@@ -127,7 +127,7 @@ public class MinimalBodyDescriptor imple
             contentTransferEncodingField = (ContentTransferEncodingField) field;
         } else {
             contentTransferEncodingField = ContentTransferEncodingFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), monitor);
+                    field, monitor);
         }
     }
 
@@ -136,7 +136,7 @@ public class MinimalBodyDescriptor imple
             contentLengthField = (ContentLengthField) field;
         } else {
             contentLengthField = ContentLengthFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), monitor);
+                    field, monitor);
         }
     }
 
@@ -145,7 +145,7 @@ public class MinimalBodyDescriptor imple
             contentTypeField = (ContentTypeField) field;
         } else {
             contentTypeField = ContentTypeFieldImpl.PARSER.parse(
-                    field.getName(), field.getBody(), field.getRaw(), monitor);
+                    field, monitor);
         }
         String mimetype = contentTypeField.getMimeType();
         if (mimetype != null) {

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java?rev=1127006&r1=1127005&r2=1127006&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
Tue May 24 12:35:10 2011
@@ -79,8 +79,7 @@ public abstract class SimpleContentHandl
         if (field instanceof ParsedField) {
             parsedField = (ParsedField) field;
         } else {
-            parsedField = fieldParser.parse(
-                    field.getName(), field.getBody(), field.getRaw(), monitor);
+            parsedField = fieldParser.parse(field, monitor);
         }
         currHeader.addField(parsedField);
     }



Mime
View raw message