You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by di...@apache.org on 2005/07/18 04:34:08 UTC
svn commit: r219440 -
/geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
Author: dims
Date: Sun Jul 17 19:33:57 2005
New Revision: 219440
URL: http://svn.apache.org/viewcvs?rev=219440&view=rev
Log:
implement parse
Modified:
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java?rev=219440&r1=219439&r2=219440&view=diff
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java Sun Jul 17 19:33:57 2005
@@ -23,6 +23,8 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.ByteArrayInputStream;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
import java.text.ParseException;
import java.util.Date;
import java.util.Enumeration;
@@ -190,8 +192,19 @@
* @throws MessagingException if there was a problem parsing the stream
*/
protected void parse(InputStream in) throws MessagingException {
- // TODO Implement method
- throw new UnsupportedOperationException("Method not yet implemented");
+ in = new BufferedInputStream(in);
+ headers = new InternetHeaders(in);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ byte buffer[] = new byte[1024];
+ int count;
+ while ((count = in.read(buffer, 0, 1024)) != -1) {
+ baos.write(buffer, 0, count);
+ }
+ } catch (Exception e) {
+ throw new MessagingException(e.toString(), e);
+ }
+ content = baos.toByteArray();
}
public Address[] getFrom() throws MessagingException {