com.mirrorworlds.lifestreams.mail.tnef
Class TnefStreamParserImpl

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

public class TnefStreamParserImpl
extends java.lang.Object
implements TnefStreamParser

A simple implementation of the TnefStreamParser interface. This class parses the TNEF attributes and invokes the methods on the TnefBuilder to build the parsed data.

For more information (good luck), search for "TNEF Stream Syntax" and "TNEF Stream Structure" at http://www.microsoft.com

Version:
Feb 20, 2000 Lifestreams 1.5

Field Summary
protected  TnefBuilder builder
          Tnef builder.
 
Constructor Summary
TnefStreamParserImpl()
           
 
Method Summary
 void debug(java.lang.String s)
           
 void parse(java.io.InputStream inputstream)
          Starts the parsing process.
protected  void readAttachSeq(java.io.PushbackInputStream in)
          Reads a AttachSeq.
protected  void readAttAttributeSeq(java.io.PushbackInputStream in)
          Reads a Attach_Attribute_Sequence
protected  void readAttMessageClass(java.io.PushbackInputStream in)
          Parses Tnef MessageClass token.
protected  void readAttTnefVersion(java.io.PushbackInputStream in)
          Parses a Tnef Version.
protected  int readLEInt(java.io.PushbackInputStream in)
           
protected  short readLEShort(java.io.PushbackInputStream in)
           
protected  int readLEUnsignedShort(java.io.PushbackInputStream in)
           
protected  void readMessageSeq(java.io.PushbackInputStream in)
          Parses a Tnef MessageSequence.
protected  boolean readMsgAttribute(java.io.PushbackInputStream in)
          Parses Tnef MessageAttribute token.
protected  void readMsgAttributeSeq(java.io.PushbackInputStream in)
          Parses Tnef Message Attribute Sequence token
protected  void readObject(java.io.PushbackInputStream in)
          Parses a Tnef Object.
 void setBuilder(TnefBuilder builder)
          Associates a builder.
protected  void unreadInt(java.io.PushbackInputStream in, int b)
          Unreads (pushes back)a given int (32 bit) into the pushback stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

builder

protected TnefBuilder builder
Tnef builder.
Constructor Detail

TnefStreamParserImpl

public TnefStreamParserImpl()
Method Detail

setBuilder

public void setBuilder(TnefBuilder builder)
Associates a builder. The builder will be responsible for composing the final TNEF message object.
Specified by:
setBuilder in interface TnefStreamParser
Parameters:
builder - TnefBuilder implementation.

parse

public void parse(java.io.InputStream inputstream)
           throws java.io.IOException
Starts the parsing process. The Parser expects that the TNefBuilder has already been set.
 TnefStream = TnefSignature TnefKey TnefObject
 
Specified by:
parse in interface TnefStreamParser
Parameters:
inputstream - TNEF message stream. eg: new FileInputStream("winmail.dat")
Throws:
java.io.IOException - due to parse errors or builder errors.

readObject

protected void readObject(java.io.PushbackInputStream in)
                   throws java.io.IOException
Parses a Tnef Object.
  TnefObject = MessageSequence | MessageSequence AttachSequence | AttachSequence
 

readMessageSeq

protected void readMessageSeq(java.io.PushbackInputStream in)
                       throws java.io.IOException
Parses a Tnef MessageSequence.
  MessageSequence = 
 

readAttTnefVersion

protected void readAttTnefVersion(java.io.PushbackInputStream in)
                           throws java.io.IOException
Parses a Tnef Version. Once the version is parsed, the Builder's setTnefVersion(version) method is invoked.
  attTnefVersion = LVL_MESSAGE attTnefVerion sizeof(ulong) 0x00010000 checksum
 

readAttMessageClass

protected void readAttMessageClass(java.io.PushbackInputStream in)
                            throws java.io.IOException
Parses Tnef MessageClass token. Once the MessageClass is parsed, the Builder's setMessageAttribute(id,bytes) method is invoked.
  attMessageClass = LVL_MESSAGE attMessageClass length_int msg_class_data checksum
 

readMsgAttributeSeq

protected void readMsgAttributeSeq(java.io.PushbackInputStream in)
                            throws java.io.IOException
Parses Tnef Message Attribute Sequence token
  MessageAttribSequence = MessageAttribute | MessageAttribute MessageAttributeSequence
 

readMsgAttribute

protected boolean readMsgAttribute(java.io.PushbackInputStream in)
                            throws java.io.IOException
Parses Tnef MessageAttribute token. Once the attribute is parsed, the Builder's setMessageAttribute(id,bytes) method is invoked.
  MessageAttribute = LVL_MESSAGE attribute_id attribute_length_int attrib_data checksum
 

readAttachSeq

protected void readAttachSeq(java.io.PushbackInputStream in)
                      throws java.io.IOException
Reads a AttachSeq.
  Attach_Seq = attRendData | attRendData Att_Attribute_Seq
 

readAttAttributeSeq

protected void readAttAttributeSeq(java.io.PushbackInputStream in)
                            throws java.io.IOException
Reads a Attach_Attribute_Sequence
  Attach_Attribute_Seq = Att_Attribute | Att_Attribute Att_Attribute_Seq
 

readLEShort

protected short readLEShort(java.io.PushbackInputStream in)
                     throws java.io.IOException
Returns:
a signed short (16 bit) value read in Little Endian format.

readLEUnsignedShort

protected int readLEUnsignedShort(java.io.PushbackInputStream in)
                           throws java.io.IOException
Returns:
an unsigned short (16 bit) value read in Little Endian format.

readLEInt

protected int readLEInt(java.io.PushbackInputStream in)
                 throws java.io.IOException
Returns:
a signed int (32 bit) value read in Little Endian format.

unreadInt

protected void unreadInt(java.io.PushbackInputStream in,
                         int b)
                  throws java.io.IOException
Unreads (pushes back)a given int (32 bit) into the pushback stream.

debug

public void debug(java.lang.String s)