|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mirrorworlds.lifestreams.mail.tnef.TnefMessage
This class contains a Tnef Message decoded from a TNEF byte stream.
Note that the TnefMessage class is not related to the Java Mail API's
Message
class. A TnefMessage class can contain one or
more attachments.
Example:
try { String filename = "winmail.dat"; //create message object using default parser and builder. TnefMessage msg = JTnef.createTnefMessage(filename); msg.printInfo(); // print debug info int count = msg.getCount(); // get number of attachments. for (int i = 0; i < count; i++) { // loop thru attachments and print TnefAttachment a = msg.getAttachmentAt(i); System.out.println(" -- "); a.printInfo(); // content-type of attachment is a.getContentType(); // filename of attachment is a.getFilename(); // attachment stream is a.getInputStream(); // you can save attachment: // File f = new File(a.getFilename); // FileOutputStream fos = new FileOutputStream(f); // a.writeTo(f); // save attachment. } }catch(Exception e) { e.printStackTrace }
Constructor Summary | |
TnefMessage()
Creates an empty TNEF message. |
Method Summary | |
void |
addAttachment(TnefAttachment attachment)
Adds an attachment to this message. |
TnefAttachment |
getAttachmentAt(int index)
|
java.lang.String |
getAttribute(java.lang.String name)
|
java.lang.String |
getContentType()
|
int |
getCount()
|
int |
getKey()
|
int |
getPriority()
|
int |
getSignature()
|
java.lang.String |
getText()
|
int |
getTnefVersion()
|
void |
printInfo()
Prints debugging info. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets the message attributes such as subject, date-received etc. |
void |
setDate(java.util.Date d)
Sets the date. |
void |
setKey(int key)
Sets the TNEF message 16 bit key |
void |
setPriority(int prio)
Sets the message priority. |
void |
setSignature(int signature)
Sets the TNEF stream 32 bit signature. |
void |
setText(java.lang.String text)
Sets the message body text. |
void |
setTnefVersion(int version)
Sets the TNEF stream (32 bit) version. |
void |
writeToMIME(java.io.OutputStream out)
Writes this message (and its attachments) as a MIME multipart/mixed message. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public TnefMessage()
Method Detail |
public int getCount()
public java.lang.String getContentType()
public TnefAttachment getAttachmentAt(int index) throws java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getAttribute(java.lang.String name)
public void setAttribute(java.lang.String name, java.lang.String value)
name
- attribute namevalue
- value of attribute.public void setText(java.lang.String text)
text
- message bodypublic java.lang.String getText()
public void setSignature(int signature)
public int getSignature()
public void setKey(int key)
public int getKey()
public void setTnefVersion(int version)
public int getTnefVersion()
public void setPriority(int prio)
public int getPriority()
public void addAttachment(TnefAttachment attachment)
public void setDate(java.util.Date d)
public void writeToMIME(java.io.OutputStream out) throws java.io.IOException
method not implemented. TBD.
public void printInfo()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |