| java.lang.Object com.protomatter.util.MIMEAttachment
MIMEAttachment | public class MIMEAttachment implements Serializable(Code) | | This class is used in conjunction with the MIMEMessage class
to make a multipart MIME message. A MIMEAttachment enacpsulates
a single attachment (i.e. an image, a document, etc). Attached
binaries are encoded using the Base64 method.
See Also: MIMEMessage |
Constructor Summary | |
public | MIMEAttachment(String type, String description, String content) Create a MIMEAttachment object with the given MIME content type and
description. | public | MIMEAttachment(String type, String description, byte[] data, boolean isBinary) Create a MIMEAttachment object with the given MIME content type and
description. | public | MIMEAttachment(String type, String description, byte[] data) Create a MIMEAttachment object with the given MIME type and
description. | public | MIMEAttachment() Create an empty attachment. |
MIMEAttachment | public MIMEAttachment(String type, String description, String content)(Code) | | Create a MIMEAttachment object with the given MIME content type and
description. The content will not be encoded using Base64.
|
MIMEAttachment | public MIMEAttachment(String type, String description, byte[] data, boolean isBinary)(Code) | | Create a MIMEAttachment object with the given MIME content type and
description. The content will be encoded using Base64 if
the isBinary flag is true.
|
MIMEAttachment | public MIMEAttachment(String type, String description, byte[] data)(Code) | | Create a MIMEAttachment object with the given MIME type and
description. The content will be encoded using Base64.
|
MIMEAttachment | public MIMEAttachment()(Code) | | Create an empty attachment.
|
getContent | public byte[] getContent()(Code) | | Return the content. If it's binary, it's a byte array
of binary data, if it's ASCII, you can just call
new String(attachmentgetContent()).
|
getHeaderNames | public Enumeration getHeaderNames()(Code) | | Get an Enumeration of the header names.
|
getSubHeader | public String getSubHeader(String name, String sub)(Code) | | Some headers (such as Content-Disposition) have multiple
key="value" pairs associated with them. This method allows
you to get at those values easily. For instance, to get
the "filename" chunk of the "Content-Disposition" header,
call getSubHeader("Content-Disposition", "filename");
If you call it with sub = "", it will retrieve the first
value (which doesn't have a name)
|
isBinary | public boolean isBinary()(Code) | | Is the content of the attachment ascii or binary?
|
removeHeader | public void removeHeader(String headerName)(Code) | | Remove a header value.
|
setBinary | public void setBinary(boolean b)(Code) | | Set the flag to indicate that the content
of this attachment is binary.
|
setContent | public void setContent(String content)(Code) | | Set the content of this attachment.
|
setContent | public void setContent(byte[] content)(Code) | | Set the content of this attachment.
|
setHeader | public void setHeader(String headerName, String headerVal)(Code) | | Set a header value.
|
setHeaders | public void setHeaders(Hashtable headers)(Code) | | Set the headers. Keys and values in
must be strings.
|
toString | public String toString()(Code) | | Produces a chunk of text, including the encoded attachment object
|
write | public void write(PrintWriter w)(Code) | | Append the content of this attachment to
the given StringBuffer.
|
|
|