Protomatter Classes v1.1.6

com.protomatter.util
Class MIMEMessage

java.lang.Object
  |
  +--com.protomatter.util.MIMEMessage
All Implemented Interfaces:
java.io.Serializable

public class MIMEMessage
extends java.lang.Object
implements java.io.Serializable

A MIME encoded message. This is basically a collection of MIMEAttachment objects. This class takes care of the ASCII encoding of the message as a whole, including the segment boundary, etc... It does NOT take care of any headers other than the Content-Type, which it always identifies as "MULTIPART/MIXED". This class can also be used to parse "file upload" information out of HTML forms.

See Also:
MIMEAttachment, Serialized Form

Constructor Summary
MIMEMessage()
          Initialize the MIMEMessage.
 
Method Summary
 void addAttachment(MIMEAttachment a)
          Add an attachment to this message
 java.util.Enumeration getAttachments()
          Get an enumeration of the attachments to this message.
 java.lang.String getBoundary()
          Get the boundary between parts of the message.
 java.lang.String getContentType()
          Get the Content-Type of this message, also includes the boundary.
static boolean isBinaryContent(byte[] data)
          Scan the content and decide if it's binary or ASCII data.
static boolean isBinaryContent(byte[] data, int start, int len)
          Scan the content and decide if it's binary or ASCII data.
static void main(java.lang.String[] args)
           
static MIMEMessage parse(byte[] data)
          Return a MIMEMessage built from the data.
static MIMEMessage parse(java.io.InputStream s)
          Return a MIMEMessage built from the InputStream that points to a MIME message.
 void removeAttachment(MIMEAttachment a)
          Remove an attachment to this message
 void setBoundary(java.lang.String boundary)
          Set the boundary between parts of the message.
 java.lang.String toString()
          Return the encoded message (including all attachments)
 void write(java.io.PrintWriter w)
          Write this message to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MIMEMessage

public MIMEMessage()
Initialize the MIMEMessage.
Method Detail

getContentType

public java.lang.String getContentType()
Get the Content-Type of this message, also includes the boundary.

addAttachment

public void addAttachment(MIMEAttachment a)
Add an attachment to this message

removeAttachment

public void removeAttachment(MIMEAttachment a)
Remove an attachment to this message

getAttachments

public java.util.Enumeration getAttachments()
Get an enumeration of the attachments to this message.

getBoundary

public java.lang.String getBoundary()
Get the boundary between parts of the message.

setBoundary

public void setBoundary(java.lang.String boundary)
Set the boundary between parts of the message.

toString

public java.lang.String toString()
Return the encoded message (including all attachments)
Overrides:
toString in class java.lang.Object

write

public void write(java.io.PrintWriter w)
Write this message to the given output stream.

parse

public static MIMEMessage parse(java.io.InputStream s)
                         throws MIMEException
Return a MIMEMessage built from the InputStream that points to a MIME message. Reads the stream fully before parsing, so watch out.

parse

public static MIMEMessage parse(byte[] data)
                         throws MIMEException
Return a MIMEMessage built from the data.

isBinaryContent

public static boolean isBinaryContent(byte[] data)
Scan the content and decide if it's binary or ASCII data.

isBinaryContent

public static boolean isBinaryContent(byte[] data,
                                      int start,
                                      int len)
Scan the content and decide if it's binary or ASCII data.

main

public static void main(java.lang.String[] args)

Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6