com.lowagie.text.rtf.direct
Class RtfTokeniser

java.lang.Object
  extended bycom.lowagie.text.rtf.direct.RtfTokeniser

public class RtfTokeniser
extends Object

The RtfTokeniser takes an RTF document stream and turns it into a set of RTF tokens. Five groups of tokens are differentiated:

Version:
$Revision: 1.7 $
Author:
Mark Hall (mhall@edu.uni-klu.ac.at), Bullo (bullo70@users.sourceforge.net)

Field Summary
private  int groupLevel
          The current group nesting level.
private  RtfParser rtfParser
          The RtfParser to send tokens to.
private  int state
          The current state of this RtfTokeniser.
private static int TOKENISER_STATE_IN_CTRL_WORD
          The RtfTokeniser is currently tokenising a control word.
private static int TOKENISER_STATE_IN_TEXT
          The RtfTokeniser is currently tokenising a text.
private static int TOKENISER_STATE_READY
          The RtfTokeniser is in its ground state.
private static int TOKENISER_STATE_SLASH
          The last token parsed was a slash.
 
Constructor Summary
RtfTokeniser(RtfParser rtfParser, int startGroupLevel)
          Constructs a new RtfTokeniser.
 
Method Summary
 void tokenise(Reader reader)
          The main tokenisation method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKENISER_STATE_READY

private static final int TOKENISER_STATE_READY
The RtfTokeniser is in its ground state. Any token may follow.

See Also:
Constant Field Values

TOKENISER_STATE_SLASH

private static final int TOKENISER_STATE_SLASH
The last token parsed was a slash.

See Also:
Constant Field Values

TOKENISER_STATE_IN_CTRL_WORD

private static final int TOKENISER_STATE_IN_CTRL_WORD
The RtfTokeniser is currently tokenising a control word.

See Also:
Constant Field Values

TOKENISER_STATE_IN_TEXT

private static final int TOKENISER_STATE_IN_TEXT
The RtfTokeniser is currently tokenising a text.

See Also:
Constant Field Values

state

private int state
The current state of this RtfTokeniser.


groupLevel

private int groupLevel
The current group nesting level.


rtfParser

private RtfParser rtfParser
The RtfParser to send tokens to.

Constructor Detail

RtfTokeniser

public RtfTokeniser(RtfParser rtfParser,
                    int startGroupLevel)
Constructs a new RtfTokeniser. The startGroupLevel is required when parsing RTF fragments, since they are missing the opening group and closing group and thus this has to be set at the beginning.

Parameters:
rtfParser - The RtfParser to send tokens to.
startGroupLevel - The starting group nesting level. 0 for full documents, 1 for fragments.
Method Detail

tokenise

public void tokenise(Reader reader)
              throws IOException
The main tokenisation method. Implements a LL(1) parser.

Parameters:
reader - The Reader to read the RTF document from.
Throws:
IOException - On I/O errors.