net.sourceforge.rtf.parser
Class AbstractCoreRTFParser

java.lang.Object
  extended by net.sourceforge.rtf.parser.AbstractCoreRTFParser
Direct Known Subclasses:
AbstractDefaultRTFParser, RTFIndentHandler

public abstract class AbstractCoreRTFParser
extends java.lang.Object

Core RTF parser which is able to parse RTF Stream (Reader) character by character. It launch events on special characters {, } and \ :

To use this abstract class, you must implement events startGroup, endGroup and handleKeyword.

Version:
1.0.0
Author:
Angelo ZERR
See Also:
RTFIndentHandler, AbstractDefaultRTFParser

Constructor Summary
AbstractCoreRTFParser()
          Constructor.
 
Method Summary
protected abstract  void endGroup(char endGroupCharacter, int level)
          Event end group.
protected  int getLevel()
          Return level of current group.
protected abstract  void handleKeyword(java.lang.String content)
          Event RTF keyword.
 void parse(java.io.InputStream inputStream)
          Parse RTF Input stream.
 void parse(java.io.Reader reader)
          Parse RTF Reader stream.
protected abstract  void startGroup(char startGroupCharacter, int level)
          Event start group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCoreRTFParser

public AbstractCoreRTFParser()
Constructor.

Method Detail

parse

public void parse(java.io.Reader reader)
           throws java.io.IOException
Parse RTF Reader stream.

Parameters:
reader - RTF source reader to parse.
Throws:
java.io.IOException

parse

public void parse(java.io.InputStream inputStream)
           throws java.io.IOException
Parse RTF Input stream.

Parameters:
input - stream RTF source reader to parse.
Throws:
java.io.IOException

getLevel

protected int getLevel()
Return level of current group.

Returns:
level of current group

startGroup

protected abstract void startGroup(char startGroupCharacter,
                                   int level)
                            throws java.io.IOException
Event start group. This event is launched when character { is found.

Parameters:
startGroupCharacter - start group character {.
level - of current group.
Throws:
java.io.IOException

endGroup

protected abstract void endGroup(char endGroupCharacter,
                                 int level)
                          throws java.io.IOException
Event end group. This event is launched when character } is found.

Parameters:
endGroupCharacter - end group character }.
level - of current group.
Throws:
java.io.IOException

handleKeyword

protected abstract void handleKeyword(java.lang.String content)
                               throws java.io.IOException
Event RTF keyword. This event is launched when RTF content (current string parsed) end by character \.

Parameters:
content - RTF keyword.
Throws:
java.io.IOException


Copyright 2007 null. All Rights Reserved.