|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Mime
The MIME class allows for easy implementation of the Multipurpose Internet Mail Extensions or MIME as defined in RFC 1521 and updated in RFCs 2045-2049. Those standards provide for formating of messages containing non-text, multipart or non 'US' formated text.
The class's operation is controlled by the Action property. It may be used for decoding or encoding of messages. Message holds the content of the encoded message or the filename which holds the encoded data. The decoded data is put in PartDecodedString and/or PartDecodedFile depending on the user's query.
To decode a MIME message you should first assign either the whole message (headers and body) to Message or put the message headers to MessageHeaders and the message body or the filename holding it to Message . Setting Action property to decode directs the class to start parsing the message: it will fill out the ContentType , ContentTypeAttr and PartCount properties as well as the array properties PartSize , PartContentType , PartContentTypeAttr , PartContentDisposition , PartContentDispositionAttr , PartEncoding , PartName , PartFilename , PartHeaders , for each decoded part from 0 to PartCount -1.
For each part you may then get the content out of PartDecodedString or PartDecodedFile properties. Setting Action to decode doesn't actually decode the message but only parses it. The real decoding is done when the respective array property PartDecodedFile or PartDecodedString is first accessed for any particular index.
To encode data into a MIME message you should first assign values for each part to either PartDecodedString or PartDecodedFile , optionally assign values to the other Part- properties. Assiging a value to the PartDecodedString or PartDecodedFile properties fills out automatically the PartHeaders property for the respective part. Set Action property to encode directs the class to fill out the Message with the message body and the MessageHeaders with the headers.
The Progress event is fired as the message is parsed and the data is decoded/encoded.
Field Summary | |
static int |
a_DecodeFromFile
|
static int |
a_DecodeFromString
|
static int |
a_EncodeToFile
|
static int |
a_EncodeToString
|
static int |
a_Idle
|
static int |
a_ResetData
|
static int |
pe_7Bit
|
static int |
pe_8Bit
|
static int |
pe_Base64
|
static int |
pe_Binary
|
static int |
pe_QuotedPrintable
|
Constructor Summary | |
Mime()
|
Method Summary | |
void |
addMimeEventListener(MimeEventListener l)
|
void |
fireProgress(int percentDone)
Shows the progress of decoding/encoding the input data. |
int |
getAction()
Controls the operation of MIME component. |
java.lang.String |
getBoundary()
The boundary separating the MIME parts. |
java.lang.String |
getContentType()
The value of the content-type header of the message which was encoded/decoded. |
java.lang.String |
getContentTypeAttr()
The attributes for content-type header of the message which was encoded/decoded. |
byte[] |
getMessage()
Filename holding the encoded message or the encoded message itself. |
java.lang.String |
getMessageHeaders()
The headers of the MIME message. |
java.lang.String |
getPartContentDisposition(int partIdx)
Content Disposition for each part 0 to PartCount -1. |
java.lang.String |
getPartContentDispositionAttr(int partIdx)
Array holding the content disposition's attributes, if any, for each part, numbered 0 to PartCount -1. |
java.lang.String |
getPartContentType(int partIdx)
Content type for each part 0 to PartCount -1. |
java.lang.String |
getPartContentTypeAttr(int partIdx)
Array holding the content type attributes, if any, for each part, numbered 0 to PartCount -1. |
int |
getPartCount()
The number of MIME parts in the encoded message. |
java.lang.String |
getPartDecodedFile(int partIdx)
Array holding the filenames with the decoded data numbered 0 to PartCount -1. |
byte[] |
getPartDecodedString(int partIdx)
Array property. |
int |
getPartEncoding(int partIdx)
The actual content encoding type for each part 0 to PartCount -1. |
java.lang.String |
getPartFilename(int partIdx)
The filename attribute specified in the headers of the part. |
java.lang.String |
getPartHeaders(int partIdx)
Headers for each MIME part, numbered 0 to PartCount -1. |
java.lang.String |
getPartName(int partIdx)
The name given to a part, such as the filename. |
int |
getPartSize(int partIdx)
The size of each PartDecodedFile or PartDecodedString . |
void |
removeMimeEventListener(MimeEventListener l)
|
void |
setAction(int action)
Controls the operation of MIME component. |
void |
setBoundary(java.lang.String boundary)
The boundary separating the MIME parts. |
void |
setContentType(java.lang.String contentType)
The value of the content-type header of the message which was encoded/decoded. |
void |
setContentTypeAttr(java.lang.String contentTypeAttr)
The attributes for content-type header of the message which was encoded/decoded. |
void |
setMessage(byte[] message)
Filename holding the encoded message or the encoded message itself. |
void |
setMessageHeaders(java.lang.String messageHeaders)
The headers of the MIME message. |
void |
setPartContentDisposition(int partIdx,
java.lang.String partContentDisposition)
Content Disposition for each part 0 to PartCount -1. |
void |
setPartContentDispositionAttr(int partIdx,
java.lang.String partContentDispositionAttr)
Array holding the content disposition's attributes, if any, for each part, numbered 0 to PartCount -1. |
void |
setPartContentType(int partIdx,
java.lang.String partContentType)
Content type for each part 0 to PartCount -1. |
void |
setPartContentTypeAttr(int partIdx,
java.lang.String partContentTypeAttr)
Array holding the content type attributes, if any, for each part, numbered 0 to PartCount -1. |
void |
setPartCount(int partCount)
The number of MIME parts in the encoded message. |
void |
setPartDecodedFile(int partIdx,
java.lang.String partDecodedFile)
Array holding the filenames with the decoded data numbered 0 to PartCount -1. |
void |
setPartDecodedString(int partIdx,
byte[] partDecodedString)
Array property. |
void |
setPartEncoding(int partIdx,
int partEncoding)
The actual content encoding type for each part 0 to PartCount -1. |
void |
setPartFilename(int partIdx,
java.lang.String partFilename)
The filename attribute specified in the headers of the part. |
void |
setPartHeaders(int partIdx,
java.lang.String partHeaders)
Headers for each MIME part, numbered 0 to PartCount -1. |
void |
setPartName(int partIdx,
java.lang.String partName)
The name given to a part, such as the filename. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int a_Idle
public static final int a_DecodeFromFile
public static final int a_DecodeFromString
public static final int a_EncodeToFile
public static final int a_EncodeToString
public static final int a_ResetData
public static final int pe_7Bit
public static final int pe_QuotedPrintable
public static final int pe_Base64
public static final int pe_8Bit
public static final int pe_Binary
Constructor Detail |
public Mime()
Method Detail |
public int getAction()
The following are the possible values for the Action property and the corresponding descriptions:
public void setAction(int action) throws IPWorksException
The following are the possible values for the Action property and the corresponding descriptions:
public java.lang.String getBoundary()
The class will truncate any string longer than 80 if assigned to Boundary .
public void setBoundary(java.lang.String boundary) throws IPWorksException
The class will truncate any string longer than 80 if assigned to Boundary .
public java.lang.String getContentType()
The content-type attributes such as filename, boundary, charset etc are held in the ContentTypeAttr property.
public void setContentType(java.lang.String contentType) throws IPWorksException
The content-type attributes such as filename, boundary, charset etc are held in the ContentTypeAttr property.
public java.lang.String getContentTypeAttr()
public void setContentTypeAttr(java.lang.String contentTypeAttr) throws IPWorksException
public byte[] getMessage()
public void setMessage(byte[] message) throws IPWorksException
public java.lang.String getMessageHeaders()
During decoding, if MessageHeaders is empty, the class will try to find the headers in the begining of the Message and will fill out MessageHeaders property accordingly.
public void setMessageHeaders(java.lang.String messageHeaders) throws IPWorksException
During decoding, if MessageHeaders is empty, the class will try to find the headers in the begining of the Message and will fill out MessageHeaders property accordingly.
public java.lang.String getPartContentType(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public void setPartContentType(int partIdx, java.lang.String partContentType) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartContentTypeAttr(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public void setPartContentTypeAttr(int partIdx, java.lang.String partContentTypeAttr) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartContentDisposition(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public void setPartContentDisposition(int partIdx, java.lang.String partContentDisposition) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartContentDispositionAttr(int partIdx) throws IPWorksException
Setting this property recalculates the PartHeaders property.
A valid PartIdx is 0 to PartCount -1.
public void setPartContentDispositionAttr(int partIdx, java.lang.String partContentDispositionAttr) throws IPWorksException
Setting this property recalculates the PartHeaders property.
A valid PartIdx is 0 to PartCount -1.
public int getPartEncoding(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
Possible values for PartEncoding are:
public void setPartEncoding(int partIdx, int partEncoding) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
Possible values for PartEncoding are:
public java.lang.String getPartDecodedFile(int partIdx) throws IPWorksException
Setting a value to PartDecodedFile directs the component to calculate the file size and fill out the respective PartSize property.
Valid PartIdx values are 0 to PartCount -1.
public void setPartDecodedFile(int partIdx, java.lang.String partDecodedFile) throws IPWorksException
Setting a value to PartDecodedFile directs the component to calculate the file size and fill out the respective PartSize property.
Valid PartIdx values are 0 to PartCount -1.
public byte[] getPartDecodedString(int partIdx) throws IPWorksException
Setting a value to PartDecodedString fills out the PartSize property with the string size if PartDecodedFile is empty. The class checks during encoding first PartDecodedFile : if it is empty then the class uses the value of PartDecodedString .
A valid PartIdx is 0 to PartCount -1.
public void setPartDecodedString(int partIdx, byte[] partDecodedString) throws IPWorksException
Setting a value to PartDecodedString fills out the PartSize property with the string size if PartDecodedFile is empty. The class checks during encoding first PartDecodedFile : if it is empty then the class uses the value of PartDecodedString .
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartFilename(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public void setPartFilename(int partIdx, java.lang.String partFilename) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartName(int partIdx) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public void setPartName(int partIdx, java.lang.String partName) throws IPWorksException
A valid PartIdx is 0 to PartCount -1.
public java.lang.String getPartHeaders(int partIdx) throws IPWorksException
Valid PartIdx values are 0 to PartCount -1.
public void setPartHeaders(int partIdx, java.lang.String partHeaders) throws IPWorksException
Valid PartIdx values are 0 to PartCount -1.
public int getPartSize(int partIdx) throws IPWorksException
During decoding the PartSize is filled with the size of each part as soon as Action is set to decode.
public int getPartCount()
public void setPartCount(int partCount) throws IPWorksException
public void fireProgress(int percentDone)
MimeProgressEvent
public void addMimeEventListener(MimeEventListener l) throws java.util.TooManyListenersException
public void removeMimeEventListener(MimeEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |