net.freeutils.tnef

Class Attr

public class Attr extends Object

The Attr class encapsulates a TNEF attribute. A TNEF stream consists of a flat list of attributes, which belong either to the message level or attachment level. An attAttachRenddata attribute marks the beginning of an attachment, and all subsequent attributes (until the next attachment begins) belong to it. Different attributes have a different meaning for the underlying raw data, thus the getValue() method returns different types of objects. The object returned is determined by the attribute type, except for several special cases.

Since: 2003-04-25

Field Summary
static intatpByte
Attribute type constant.
static intatpDate
Attribute type constant.
static intatpDword
Attribute type constant.
static intatpLong
Attribute type constant.
static intatpMax
Attribute type constant.
static intatpShort
Attribute type constant.
static intatpString
Attribute type constant.
static intatpText
Attribute type constant.
static intatpTriples
Attribute type constant.
static intatpWord
Attribute type constant.
static intattAidOwner
Attribute ID constant.
static intattAttachCreateDate
Attribute ID constant.
static intattAttachData
Attribute ID constant.
static intattAttachment
Attribute ID constant.
static intattAttachMetaFile
Attribute ID constant.
static intattAttachModifyDate
Attribute ID constant.
static intattAttachRenddata
Attribute ID constant.
static intattAttachTitle
Attribute ID constant.
static intattAttachTransportFilename
Attribute ID constant.
static intattBody
Attribute ID constant.
static intattConversationID
Attribute ID constant.
static intattDateEnd
Attribute ID constant.
static intattDateModified
Attribute ID constant.
static intattDateRecd
Attribute ID constant.
static intattDateSent
Attribute ID constant.
static intattDateStart
Attribute ID constant.
static intattDelegate
Attribute ID constant.
static intattFrom
Attribute ID constant.
static intattMAPIProps
Attribute ID constant.
static intattMessageClass
Attribute ID constant.
static intattMessageID
Attribute ID constant.
static intattMessageStatus
Attribute ID constant.
static intattNull
Attribute ID constant.
static intattOemCodepage
Attribute ID constant.
static intattOriginalMessageClass
Attribute ID constant.
static intattOwner
Attribute ID constant.
static intattParentID
Attribute ID constant.
static intattPriority
Attribute ID constant.
static intattRecipTable
Attribute ID constant.
static intattRequestRes
Attribute ID constant.
static intattSentFor
Attribute ID constant.
static intattSubject
Attribute ID constant.
static intattTnefVersion
Attribute ID constant.
static byteLVL_ATTACHMENT
Attribute level constant.
static byteLVL_MESSAGE
Attribute level constant.
Constructor Summary
Attr(byte level, int type, int ID, Object data)
Constructs an Attr containing the specified values.
Attr(byte level, int type, int ID, RawInputStream rawData)
Constructs an Attr containing the specified values.
Method Summary
static AttrfindAttr(List attributes, int ID)
Finds an attribute with the specified ID within given attribute list.
intgetID()
Gets the Attr ID.
intgetLength()
Gets the Attr data length (in bytes).
bytegetLevel()
Gets the Attr level.
RawInputStreamgetRawData()
Gets the Attr raw data.
intgetType()
Gets the Attr type.
ObjectgetValue()
Returns the value of the Attr's data.
protected voidread(RawInputStream in)
Reads this attribute's data from the given RawInputStream.
StringtoString()
Returns a string representation of this object.

Field Detail

atpByte

public static final int atpByte
Attribute type constant.

atpDate

public static final int atpDate
Attribute type constant.

atpDword

public static final int atpDword
Attribute type constant.

atpLong

public static final int atpLong
Attribute type constant.

atpMax

public static final int atpMax
Attribute type constant.

atpShort

public static final int atpShort
Attribute type constant.

atpString

public static final int atpString
Attribute type constant.

atpText

public static final int atpText
Attribute type constant.

atpTriples

public static final int atpTriples
Attribute type constant.

atpWord

public static final int atpWord
Attribute type constant.

attAidOwner

public static final int attAidOwner
Attribute ID constant.

attAttachCreateDate

public static final int attAttachCreateDate
Attribute ID constant.

attAttachData

public static final int attAttachData
Attribute ID constant.

attAttachment

public static final int attAttachment
Attribute ID constant.

attAttachMetaFile

public static final int attAttachMetaFile
Attribute ID constant.

attAttachModifyDate

public static final int attAttachModifyDate
Attribute ID constant.

attAttachRenddata

public static final int attAttachRenddata
Attribute ID constant.

attAttachTitle

public static final int attAttachTitle
Attribute ID constant.

attAttachTransportFilename

public static final int attAttachTransportFilename
Attribute ID constant.

attBody

public static final int attBody
Attribute ID constant.

attConversationID

public static final int attConversationID
Attribute ID constant.

attDateEnd

public static final int attDateEnd
Attribute ID constant.

attDateModified

public static final int attDateModified
Attribute ID constant.

attDateRecd

public static final int attDateRecd
Attribute ID constant.

attDateSent

public static final int attDateSent
Attribute ID constant.

attDateStart

public static final int attDateStart
Attribute ID constant.

attDelegate

public static final int attDelegate
Attribute ID constant.

attFrom

public static final int attFrom
Attribute ID constant.

attMAPIProps

public static final int attMAPIProps
Attribute ID constant.

attMessageClass

public static final int attMessageClass
Attribute ID constant.

attMessageID

public static final int attMessageID
Attribute ID constant.

attMessageStatus

public static final int attMessageStatus
Attribute ID constant.

attNull

public static final int attNull
Attribute ID constant.

attOemCodepage

public static final int attOemCodepage
Attribute ID constant.

attOriginalMessageClass

public static final int attOriginalMessageClass
Attribute ID constant.

attOwner

public static final int attOwner
Attribute ID constant.

attParentID

public static final int attParentID
Attribute ID constant.

attPriority

public static final int attPriority
Attribute ID constant.

attRecipTable

public static final int attRecipTable
Attribute ID constant.

attRequestRes

public static final int attRequestRes
Attribute ID constant.

attSentFor

public static final int attSentFor
Attribute ID constant.

attSubject

public static final int attSubject
Attribute ID constant.

attTnefVersion

public static final int attTnefVersion
Attribute ID constant.

LVL_ATTACHMENT

public static final byte LVL_ATTACHMENT
Attribute level constant.

LVL_MESSAGE

public static final byte LVL_MESSAGE
Attribute level constant.

Constructor Detail

Attr

public Attr(byte level, int type, int ID, Object data)
Constructs an Attr containing the specified values.

Parameters: level the attribute level (from LVL_* constants) type the attribute type (from atp* constants) ID the attribute ID (from att* constants) data the attribute data

Attr

public Attr(byte level, int type, int ID, RawInputStream rawData)
Constructs an Attr containing the specified values.

Parameters: level the attribute level (from LVL_* constants) type the attribute type (from atp* constants) ID the attribute ID (from att* constants) rawData the attribute's raw data

Method Detail

findAttr

public static Attr findAttr(List attributes, int ID)
Finds an attribute with the specified ID within given attribute list.

Parameters: attributes the attribute list to search ID the ID of the attribute to search for

Returns: an attribute with given ID found in the attribute list, or null if no such attribute exists

getID

public int getID()
Gets the Attr ID.

Returns: the Attr ID

getLength

public int getLength()
Gets the Attr data length (in bytes).

Returns: the Attr data length (in bytes), or -1 if it is unknown

getLevel

public byte getLevel()
Gets the Attr level.

Returns: the Attr level

getRawData

public RawInputStream getRawData()
Gets the Attr raw data.

Returns: the Attr raw data

getType

public int getType()
Gets the Attr type.

Returns: the Attr type

getValue

public Object getValue()
Returns the value of the Attr's data. Different attributes have a different meaning for the underlying raw data, thus the getValue() method returns different types of objects. The object returned is determined by the attribute type, except for several special cases. The returned Object should be cast into the appropriate class.

Returns: the value of the Attr's data

Throws: IOException if an I/O error occurs

read

protected void read(RawInputStream in)
Reads this attribute's data from the given RawInputStream.

Parameters: in the RawInputStream containing attribute data

Throws: IOException if an I/O error occurs

toString

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

Returns: a string representation of this object