com.mirrorworlds.lifestreams.mail.tnef
Class TnefAttachment

java.lang.Object
  |
  +--com.mirrorworlds.lifestreams.mail.tnef.TnefAttachment

public class TnefAttachment
extends java.lang.Object

Tnef Message Attachment

Version:
Feb 20, 2000 Lifestreams 1.5

Constructor Summary
TnefAttachment(TnefMessage parent)
          Constructs a TnefAttachment.
 
Method Summary
 java.util.Enumeration attributes()
           
 java.lang.String getAttribute(java.lang.String name)
           
 byte[] getContentBytes()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.util.Date getDate()
          Returns the date (modified) date of this attachment.
 java.lang.String getFilename()
           
 java.io.InputStream getInputStream()
           
 TnefMessage getParent()
          Returns the TnefMessage parent.
 TnefRendData getRendData()
           
 void printInfo()
          Prints debug information.
 void setAttribute(java.lang.String name, java.lang.String value)
          Sets the attachment attributes such as content-type etc.
 void setData(byte[] data)
          Sets (by the builder) the attachment data.
 void setDate(java.util.Date d)
          Sets the date associate with this attachment.
 void setRendData(TnefRendData rendData)
          Sets (by the builder) the associated RendData object.
 void writeTo(java.io.OutputStream out)
          Writes the attachment content (binary) to an output stream (useful for saving attachments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TnefAttachment

public TnefAttachment(TnefMessage parent)
Constructs a TnefAttachment. The content-type is initialized to application/octet-stream, the date is set to current time and the filename contains a random string with a '.bin' extension. These parameters are generally reset to the attachment's actual values by the Message Builder.
Parameters:
parent - message parent.
Method Detail

getParent

public TnefMessage getParent()
Returns the TnefMessage parent.

getContentType

public java.lang.String getContentType()
Returns:
MIME content-type of this attachment.

getFilename

public java.lang.String getFilename()
Returns:
filename of this attachment.

getContentLength

public int getContentLength()
Returns:
content-length in bytes if known. Same as attrubute 'content-length'.

getContentBytes

public byte[] getContentBytes()
Returns:
attachment contents as a byte array.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns:
the attribute. eg: content-type

attributes

public java.util.Enumeration attributes()
Returns:
Enumeration of all attribute names.

getRendData

public TnefRendData getRendData()
Returns:
RendData (rendering information) for this attachment.

setRendData

public void setRendData(TnefRendData rendData)
Sets (by the builder) the associated RendData object.
Parameters:
rendData - rend data associated with this attachment.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Sets the attachment attributes such as content-type etc.
Parameters:
name - attribute name
value - value of attribute.

setDate

public void setDate(java.util.Date d)
Sets the date associate with this attachment. Same as 'date-modified' and 'date' attributes.

getDate

public java.util.Date getDate()
Returns the date (modified) date of this attachment.

setData

public void setData(byte[] data)
Sets (by the builder) the attachment data.

getInputStream

public java.io.InputStream getInputStream()
Returns:
input stream to the attachment content.

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes the attachment content (binary) to an output stream (useful for saving attachments.

printInfo

public void printInfo()
Prints debug information.