public interface Part
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTACHMENT
This part should be presented as an attachment.
|
static String |
INLINE
This part should be presented or rendered inline.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(String name,
String value)
Add this value to the existing headers with the given name.
|
Enumeration |
getAllHeaders()
Return all headers as an Enumeration of Header objects.
|
Object |
getContent()
Return a content object for this Part.
|
String |
getContentType()
Get the ContentType for this part, or null if the
ContentType has not been set.
|
javax.activation.DataHandler |
getDataHandler()
Returns a DataHandler instance for the content
with in the Part.
|
String |
getDescription()
Returns a description string for this Part.
|
String |
getDisposition()
Return the disposition of the part.
|
String |
getFileName()
Get a file name associated with this part.
|
String[] |
getHeader(String name)
Get all Headers for this header name.
|
InputStream |
getInputStream()
Return an InputStream for accessing the Part
content.
|
int |
getLineCount()
Return the number of lines in the content, or
-1 if the line count cannot be determined.
|
Enumeration |
getMatchingHeaders(String[] names)
Return all headers that match the list of names as an Enumeration of
Header objects.
|
Enumeration |
getNonMatchingHeaders(String[] names)
Return an Enumeration of all Headers except those that match the names
given in the exclusion list.
|
int |
getSize()
Return the size of this part, or -1 if the size
cannot be reliably determined.
|
boolean |
isMimeType(String mimeType)
Tests if the part is of the specified MIME type.
|
void |
removeHeader(String name)
Remove all headers with the given name from the Part.
|
void |
setContent(Multipart content) |
void |
setContent(Object content,
String type)
Set a content object for this part.
|
void |
setDataHandler(javax.activation.DataHandler handler)
Set a DataHandler for this part that defines the
Part content.
|
void |
setDescription(String description)
Set a descriptive string for this part.
|
void |
setDisposition(String disposition)
Set the disposition for this Part.
|
void |
setFileName(String name)
Set a descriptive file name for this part.
|
void |
setHeader(String name,
String value)
Sets a value for the given header.
|
void |
setText(String content)
Set the Part content as text.
|
void |
writeTo(OutputStream out)
Write the Part content out to the provided OutputStream as a byte
stream using an encoding appropriate to the Part content.
|
static final String ATTACHMENT
static final String INLINE
void addHeader(String name, String value) throws MessagingException
name - The name of the target header.value - The value to be added to the header set.MessagingExceptionEnumeration getAllHeaders() throws MessagingException
MessagingExceptionObject getContent() throws IOException, MessagingException
IOExceptionMessagingExceptionString getContentType() throws MessagingException
MessagingExceptionjavax.activation.DataHandler getDataHandler()
throws MessagingException
MessagingExceptionString getDescription() throws MessagingException
MessagingExceptionString getDisposition() throws MessagingException
MessagingExceptionString getFileName() throws MessagingException
MessagingExceptionString[] getHeader(String name) throws MessagingException
name - The target header name.MessagingExceptionInputStream getInputStream() throws IOException, MessagingException
IOExceptionMessagingExceptionint getLineCount()
throws MessagingException
MessagingExceptionEnumeration getMatchingHeaders(String[] names) throws MessagingException
names - An array of names of the desired headers.MessagingExceptionEnumeration getNonMatchingHeaders(String[] names) throws MessagingException
names - An array of String header names that will be excluded from the return
Enumeration set.MessagingExceptionint getSize()
throws MessagingException
MessagingExceptionboolean isMimeType(String mimeType) throws MessagingException
mimeType - The target MIME type.MessagingExceptionvoid removeHeader(String name) throws MessagingException
name - The target header name used for removal.MessagingExceptionvoid setContent(Multipart content) throws MessagingException
MessagingExceptionvoid setContent(Object content, String type) throws MessagingException
content - The content object.type - The MIME type for the inserted content Object.MessagingExceptionvoid setDataHandler(javax.activation.DataHandler handler)
throws MessagingException
handler - The DataHandler instance.MessagingExceptionvoid setDescription(String description) throws MessagingException
description - The new description.MessagingExceptionvoid setDisposition(String disposition) throws MessagingException
disposition - The disposition string.MessagingExceptionvoid setFileName(String name) throws MessagingException
name - The new name value.MessagingExceptionvoid setHeader(String name, String value) throws MessagingException
name - The name of the target header.value - The new value for the indicated header.MessagingExceptionvoid setText(String content) throws MessagingException
content - The new text content, as a String object.MessagingExceptionvoid writeTo(OutputStream out) throws IOException, MessagingException
out - The target OutputStream.IOExceptionMessagingExceptionCopyright © 2013. All Rights Reserved.