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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]