james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r452969 - /james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java
Date Wed, 04 Oct 2006 18:36:41 GMT
Author: bago
Date: Wed Oct  4 11:36:41 2006
New Revision: 452969

URL: http://svn.apache.org/viewvc?view=rev&rev=452969
Log:
Added an optimized getRawInputStream to MimeMessageWrapper: if we have an unchanged message
we read the headers from the original inputstream (to skip them) and then return it to the
caller (Attempt to fix JAMES-649)

Modified:
    james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java

Modified: james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java?view=diff&rev=452969&r1=452968&r2=452969
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java (original)
+++ james/server/trunk/src/java/org/apache/james/core/MimeMessageWrapper.java Wed Oct  4 11:36:41
2006
@@ -529,6 +529,23 @@
         return super.getContentStream();
     }
 
+    /**
+     * @see javax.mail.internet.MimeMessage#getRawInputStream()
+     */
+    public InputStream getRawInputStream() throws MessagingException {
+        if (!messageParsed && !isModified() && source != null) {
+            InputStream is;
+            try {
+                is = source.getInputStream();
+                // skip the headers.
+                new MailHeaders(is);
+                return is;
+            } catch (IOException e) {
+                throw new MessagingException("Unable to read the stream: " + e.getMessage(),
e);
+            }
+        } else return super.getRawInputStream();
+    }
+
     
     
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message