geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r219255 - /geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java
Date Fri, 15 Jul 2005 23:00:39 GMT
Author: dims
Date: Fri Jul 15 16:00:39 2005
New Revision: 219255

URL: http://svn.apache.org/viewcvs?rev=219255&view=rev
Log:
Fix "public MimeBodyPart(InputStream in)" constructor implementation.

Modified:
    geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java

Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java?rev=219255&r1=219254&r2=219255&view=diff
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java Fri Jul 15
16:00:39 2005
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
 import java.util.Enumeration;
 import javax.activation.DataHandler;
 import javax.mail.BodyPart;
@@ -28,7 +29,7 @@
 import javax.mail.Multipart;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 154541 $ $Date: 2005-02-20 13:01:49 -0500 (Sun, 20 Feb 2005) $
  */
 public class MimeBodyPart extends BodyPart implements MimePart {
     /**
@@ -55,7 +56,17 @@
     }
 
     public MimeBodyPart(InputStream in) throws MessagingException {
-        this.contentStream = in;
+        headers = new InternetHeaders(in);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int count;
+        try {
+            while((count = in.read(buffer, 0, 1024)) != -1)
+                baos.write(buffer, 0, count);
+        } catch (IOException e) {
+            throw new MessagingException(e.toString(),e);
+        }
+        content = baos.toByteArray();
     }
 
     public MimeBodyPart(InternetHeaders headers, byte[] content) throws MessagingException
{



Mime
View raw message