|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mirrorworlds.lifestreams.mail.tnef.TnefMessageBuilder
A simple implementation of the TnefBuilder
interface.
This implementation builds a TnefMessage
based on the
attribute data bytes passed by the parser. This class ignores some
attributes such as attConversationID, attMAPIProps
etc., however
it tries to build the attachments (eg: files ) sent in a TNEF stream.
See the description on setMessageAttribute()
and
setAttachmentAttribute()
methods to see the actual
attributes used to build a message. The methods in this class are usually
invoked by the parser.
For more information (good luck), search for "Mapping of TNEF Attributes to MAPI Properties", "Mapping of Internet Mail Attributes to MAPI Properties", "TNEF Stream Syntax" and "TNEF Stream Structure" at http://www.microsoft.com
Field Summary | |
protected TnefAttachment |
attachment
The current tnef attachment. |
protected TnefContentTypes |
contentTypes
MIME content-type manager that translates file extensions to a content-type. |
protected TnefMessage |
message
Message object being built. |
Constructor Summary | |
TnefMessageBuilder()
Constructs a basic builder and an empty TnefMessage object. |
Method Summary | |
void |
addAttachment()
This method is called by the parser when it encounters a TNEF attachment (start of attachment) sequence. |
void |
debug(java.lang.String s)
|
protected int |
getInt(byte[] d)
|
TnefMessage |
getMessage()
Returns the message build by this builder. |
protected int |
getShort(byte[] d)
|
protected java.lang.String |
getString(byte[] d)
|
void |
setAttachmentAttribute(int id,
byte[] data)
Sets the TNEF stream attachment attributes. |
void |
setContentTypes(TnefContentTypes contentTypes)
Sets the content-type handler. |
void |
setKey(int key)
Sets the TNEF stream message key (16 bits). |
void |
setMessageAttribute(int id,
byte[] data)
Sets the TNEF stream message attributes. |
void |
setSignature(int signature)
Sets the TNEF stream signature (32 bits). |
void |
setTnefVersion(int version)
Sets the TNEF stream version (32 bits). |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected TnefMessage message
protected TnefAttachment attachment
protected TnefContentTypes contentTypes
Constructor Detail |
public TnefMessageBuilder()
Method Detail |
public void setContentTypes(TnefContentTypes contentTypes)
contentTypes
- content-type manager.public void setSignature(int signature) throws java.io.IOException
signature
- TNEF stream signature.public void setKey(int key)
key
- message key.public void setTnefVersion(int version)
version
- TNEF message stream version.public void setMessageAttribute(int id, byte[] data)
TnefConstants
are not guaranteed to be in the
TNEF stream. This implemention sets the following message properties
in the TnefMessage
object. (other properties are ignored).
MAPI attDateRecd = TnefMessage attribute : date-received MAPI attDateSent = TnefMessage attribute : date-sent (same as msg.getDate()) MAPI attDateModified = TnefMessage attribute : date-modified MAPI attSubject = TnefMesasge attribute : subject MAPI attMessageID = TnefMessage attribute : message-id MAPI attPriority = TnefMessage attribute : message-priority (same asmsg.getPriority()) MAPI attFrom = TBD/ignored. MAPI attConversationID= TBD/ignored. MAPI attBody = TBD/ignored. MAPI attMAPIProps = TBD/ignored. MAPI attMessageClass = TnefMessage attribute : message-classThe attributes can be accessed from the TnefMessage's
getAttribute(name)
method.(for example getAttribute("date-received")
.
Note that there is no guarantee that the above properties are in the TNEF message stream.
id
- message attribute iddata
- message attribute data bytespublic void setAttachmentAttribute(int id, byte[] data)
TnefConstants
are not guaranteed to be in the
TNEF stream. This implemention sets the following attachment properties
in the TnefAttachment
object. (other properties are ignored).
MAPI attAttachment = TBD/ignored. MAPI attAttachData = TnefAttachment : getInputStream() or getContentBytes() MAPI attAttachMetaFile = TBD/ignored. MAPI attAttachTitle = TnefAttachment attribute : title (same as getFilename()) MAPI attAttachCreateDate = TnefAttachment attribute : date-created (same as getDate()) MAPI attAttachRenddata = TnefAttachment : getRendData()The attributes can be accessed from the TnefAttachment's
getAttribute(name)
method.(for example getAttribute("filename")
. Generally attAttachTitle
attribute contains the filename. This implementation of the builder determines the content-type
of the attachment based on this filename attribute. (assuming that the TnefContentType is set
via setContentTypes()
method).
Note that there is no guarantee that the above properties are in the TNEF message stream.
id
- attachment attribute iddata
- attachment attribute data bytespublic void addAttachment()
public TnefMessage getMessage()
protected java.lang.String getString(byte[] d)
protected int getShort(byte[] d)
protected int getInt(byte[] d)
public void debug(java.lang.String s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |