All Packages Class Hierarchy This Package Previous Next Index
Class netscape.messaging.mime.MIMEBasicPart
java.lang.Object
|
+----netscape.messaging.mime.MIMEBodyPart
|
+----netscape.messaging.mime.MIMEBasicPart
- public class MIMEBasicPart
- extends MIMEBodyPart
- implements Cloneable
The MIMEBasicPart class is a common class used for all Basic
MIME BodyPart types:
Text, Image, Audio, Video, and Application. It does not represent structured
parts such as MIMEMessagePart and MIMEMultiPart.
-
APPLICATION
- Content (primary) type Application.
-
AUDIO
- Content (primary) type Audio.
-
IMAGE
- Content (primary) type Image.
-
TEXT
- Content (primary) type Text.
-
UNINITIALIZED
-
-
VIDEO
- Content (primary) type Video.
-
MIMEBasicPart()
- Default constructor.
-
MIMEBasicPart(int)
- Constructs a MIMEBasicPart object with the given content-type.
-
addHeader(String, String)
- Appends the value to an existing header.
-
clone()
- Clones an instance of this MIMEBasicPart object.
-
deleteBodyData()
- Deletes BodyData of this MIME Part.
-
deleteHeader(String)
- Deletes the requested header from this Part.
-
getAllHeaders()
- Returns all the headers in this Part as an array of Header objects.
-
getBodyData()
- Returns an InputStream to this Part's Data after decoding any
transfer encoding.
-
getContentEncoding()
- Returns value of Content-Transfer-Encoding of this MIME Part.
-
getContentMD5()
- Returns Content-MD5 of this MIME Part or NULL if Content-MD5 is not present.
-
getContentType()
- Returns Content-Type of this MIME Part.
-
getHeader(String)
- Returns the value of the requested header.
-
getMessageDataLen()
-
-
getSize()
- Returns the size of this Part's BodyData.
-
putByteStream(OutputStream)
- Outputs a byte-stream for this part with its MIME part headers and encoded
body data.
-
putByteStream(String)
- Outputs a byte-stream for this part with its MIME part headers and encoded
body data.
-
setBodyData(byte[])
- Sets BodyData of this MIME Part.
-
setBodyData(InputStream)
- Sets BodyData of this MIME Part.
-
setBodyData(String)
- Sets BodyData of this MIME Part.
-
setContentEncoding(int)
- Sets Content-Transfer-Encoding of this MIME Part.
-
setContentMD5(String)
- Sets Content-MD5 of this MIME Part.
-
setHeader(String, String)
- Sets a header of this body-part given name and value.
TEXT
public static final int TEXT
- Content (primary) type Text.
AUDIO
public static final int AUDIO
- Content (primary) type Audio.
IMAGE
public static final int IMAGE
- Content (primary) type Image.
VIDEO
public static final int VIDEO
- Content (primary) type Video.
APPLICATION
public static final int APPLICATION
- Content (primary) type Application.
UNINITIALIZED
public static final int UNINITIALIZED
MIMEBasicPart
public MIMEBasicPart(int contentType) throws MIMEException
- Constructs a MIMEBasicPart object with the given content-type.
- Parameters:
- contentType - Content type. Values:
TEXT, AUDIO, IMAGE, VIDEO, APPLICATION.
- Throws: MIMEException
- If ContentType passed is invalid.
- See Also:
- TEXT, AUDIO, IMAGE, VIDEO, APPLICATION
MIMEBasicPart
public MIMEBasicPart() throws MIMEException
- Default constructor.
Constructs a MIMEBasicPart object with MIMEBasicPart#TEXT content-type.
getContentType
public String getContentType()
- Returns Content-Type of this MIME Part.
- Overrides:
- getContentType in class MIMEBodyPart
- See Also:
- getContentType
getContentMD5
public String getContentMD5()
- Returns Content-MD5 of this MIME Part or NULL if Content-MD5 is not present.
- See Also:
- setContentMD5
setContentMD5
public void setContentMD5(String md5)
- Sets Content-MD5 of this MIME Part.
- Parameters:
- cid - String to use as Content-ID.
- See Also:
- getContentMD5
getBodyData
public InputStream getBodyData() throws IOException, MIMEException
- Returns an InputStream to this Part's Data after decoding any
transfer encoding.
- Throws: IOException
- If an IO error occurs.
- Throws: MIMEException
- If the BodyData is not present.
or an error is detected during decoding.
- See Also:
- setBodyData
setBodyData
public void setBodyData(InputStream is) throws MIMEException, IOException
- Sets BodyData of this MIME Part.
- Parameters:
- is - Stream to read input data from. This data must be un-encoded raw data.
- Throws: MIMEException
- If already set (or) if is parameter is null.
- Throws: IOException
- If an IO error occurs.
- See Also:
- getDataBuf
setBodyData
public void setBodyData(String s) throws MIMEException
- Sets BodyData of this MIME Part.
- Parameters:
- s - Source string for input data. Must be un-encoded raw data.
- Throws: MIMEException
- If already set or if is parameter is null.
setBodyData
public void setBodyData(byte s[]) throws MIMEException
- Sets BodyData of this MIME Part.
Saves a reference to the passed byte buffer.
Does not copy the data.
- Parameters:
- s - un-encoded raw data.
- Throws: MIMEException
- If already set or if s parameter is null.
deleteBodyData
public void deleteBodyData()
- Deletes BodyData of this MIME Part.
If no BodyData is present, this method has no effect.
putByteStream
public void putByteStream(String fullfilename) throws IOException, MIMEException
- Outputs a byte-stream for this part with its MIME part headers and encoded
body data.
- Parameters:
- fullfilename - Filename including full path of where to write the byte-stream.
- Throws: IOException
- If an IO error occurs.
- Throws: MIMEException
- If any required fields in the bodyPart are not set-up.
putByteStream
public void putByteStream(OutputStream os) throws IOException, MIMEException
- Outputs a byte-stream for this part with its MIME part headers and encoded
body data.
- Parameters:
- os - OutputStream to write to.
- Throws: IOException
- If an IO error occurs.
- Throws: MIMEException
- If any required fields in the bodyPart are not set-up.
getSize
public int getSize()
- Returns the size of this Part's BodyData.
- Returns:
- Size of BodyData or -1 if this part does not have bodyData.
setContentEncoding
public void setContentEncoding(int encoding) throws MIMEException
- Sets Content-Transfer-Encoding of this MIME Part.
- Parameters:
- encoding - Value that represents the encoding.
- Throws: MIMEException
- If encoding is invalid.
- See Also:
- BASE64, QP, BINARY, E7BIT, E8BIT
getContentEncoding
public int getContentEncoding()
- Returns value of Content-Transfer-Encoding of this MIME Part. -1 if none present.
- See Also:
- BASE64, QP, BINARY, E7BIT, E8BIT
setHeader
public void setHeader(String name,
String value) throws MIMEException
- Sets a header of this body-part given name and value.
To be used to set any header that is not explicitly supported with a
set method, such as X-headers. Multiple invocations on the same header
replace the old value.
- Parameters:
- name - Name of the header field. Should not include ':'
- value - Value of the header field to be added.
- Throws: MIMEException
- If either of name or value is NULL.
addHeader
public void addHeader(String name,
String value) throws MIMEException
- Appends the value to an existing header. Creates new header if one does
not exist already.
- Parameters:
- name - Name of the header field.
- value - Value of the header field to be added.
- Throws: MIMEException
- If either name or value are NULL
getHeader
public String getHeader(String name) throws MIMEException
- Returns the value of the requested header.
Returns NULL if the header is not present.
- Parameters:
- name - Name of the header field.
- Throws: MIMEException
- If name passed is a NULL.
deleteHeader
public void deleteHeader(String name) throws MIMEException
- Deletes the requested header from this Part.
- Parameters:
- name - Name of the header field.
- Throws: MIMEException
- if name is NULL.
getAllHeaders
public Header[] getAllHeaders() throws MIMEException
- Returns all the headers in this Part as an array of Header objects.
- Throws: MIMEException
- If no headers exist.
clone
public Object clone() throws CloneNotSupportedException
- Clones an instance of this MIMEBasicPart object.
- Throws: CloneNotSupportedException
- If thrown by constituent components.
- Overrides:
- clone in class MIMEBodyPart
getMessageDataLen
public int getMessageDataLen()
All Packages Class Hierarchy This Package Previous Next Index