net.freeutils.tnef

Class Attachment

public class Attachment extends Object

The Attachment class encapsulates a TNEF message attachment.

Since: 2003-04-25

Constructor Summary
Attachment()
Constructs an empty Attachment.
Method Summary
voidaddAttribute(Attr attr)
Adds an Attachment attribute.
AttrgetAttribute(int ID)
Gets a specific Attachment attribute.
ListgetAttributes()
Gets the Attachment attributes.
StringgetFilename()
Gets the Attachment filename.
MAPIPropsgetMAPIProps()
Gets the Attachment MAPI properties.
MessagegetNestedMessage()
Gets the Attachment nested message.
RawInputStreamgetRawData()
Gets the Attachment raw data.
voidsetAttributes(List attributes)
Sets the Attachment attributes.
voidsetFilename(String filename)
Sets the Attachment filename.
voidsetMAPIProps(MAPIProps MAPIProps)
Sets this Attachment's MAPI properties.
voidsetNestedMessage(Message nestedMessage)
Sets the Attachment nested message.
voidsetRawData(RawInputStream rawData)
Sets the Attachment raw data.
StringtoString()
Returns a string representation of this object.
voidwriteTo(String filename)
Writes the content of this attachment to a file.
voidwriteTo(OutputStream out)
Writes the content of this attachment to a stream.

Constructor Detail

Attachment

public Attachment()
Constructs an empty Attachment.

Method Detail

addAttribute

public void addAttribute(Attr attr)
Adds an Attachment attribute.

Parameters: attr the Attachment attribute to add

getAttribute

public Attr getAttribute(int ID)
Gets a specific Attachment attribute.

Parameters: ID the requested attribute ID

Returns: the requested Attachment attribute, or null if no such attribute exists

getAttributes

public List getAttributes()
Gets the Attachment attributes.

Returns: the Attachment attributes

getFilename

public String getFilename()
Gets the Attachment filename.

Returns: the Attachment filename, or null if none exists

getMAPIProps

public MAPIProps getMAPIProps()
Gets the Attachment MAPI properties.

Returns: the Attachment MAPI properties

getNestedMessage

public Message getNestedMessage()
Gets the Attachment nested message.

Returns: the Attachment nested message

getRawData

public RawInputStream getRawData()
Gets the Attachment raw data.

Returns: the Attachment raw data

setAttributes

public void setAttributes(List attributes)
Sets the Attachment attributes.

Parameters: attributes the Attachment attributes

setFilename

public void setFilename(String filename)
Sets the Attachment filename.

Parameters: filename the Attachment filename

setMAPIProps

public void setMAPIProps(MAPIProps MAPIProps)
Sets this Attachment's MAPI properties. Special properties will be translated into the Attachment's fields.

Parameters: MAPIProps a collection of properties to set

Throws: IOException if an I/O error occurs

setNestedMessage

public void setNestedMessage(Message nestedMessage)
Sets the Attachment nested message.

Parameters: nestedMessage the Attachment nested message

setRawData

public void setRawData(RawInputStream rawData)
Sets the Attachment raw data.

Parameters: rawData the Attachment raw data

toString

public String toString()
Returns a string representation of this object.

Returns: a string representation of this object

writeTo

public void writeTo(String filename)
Writes the content of this attachment to a file.

Parameters: filename the fully qualified filename to which the attachment content should be written

Throws: IOException if an I/O error occurs

writeTo

public void writeTo(OutputStream out)
Writes the content of this attachment to a stream.

Parameters: out the OutputStream to which the attachment content should be written

Throws: IOException if an I/O error occurs