FileDocCategorySizeDatePackage
Message.javaAPI DocAndroid 1.5 API8733Wed May 06 22:42:46 BST 2009org.apache.james.mime4j.message

Message

public class Message extends Entity implements Body
Represents a MIME message. The following code parses a stream into a Message object.
Message msg = new Message(new BufferedInputStream(
new FileInputStream("mime.msg")));
version
$Id: Message.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $

Fields Summary
Constructors Summary
public Message()
Creates a new empty Message.

    
public Message(InputStream is)
Parses the specified MIME message stream into a Message instance.

param
is the stream to parse.
throws
IOException on I/O errors.

        MimeStreamParser parser = new MimeStreamParser();
        parser.setContentHandler(new MessageBuilder());
        parser.parse(is);
    
Methods Summary
public org.apache.james.mime4j.field.UnstructuredFieldgetSubject()
Gets the Subject field.

return
the Subject field or null if it doesn't exist.

        return (UnstructuredField) getHeader().getField(Field.SUBJECT);
    
public voidwriteTo(java.io.OutputStream out)

see
org.apache.james.mime4j.message.Entity#writeTo(java.io.OutputStream)

        getHeader().writeTo(out);

        Body body = getBody();
        if (body instanceof Multipart) {
            Multipart mp = (Multipart) body;
            mp.writeTo(out);
        } else {
            body.writeTo(out);
        }