Package com.rtfparserkit.converter.text
Class AbstractTextConverter
- java.lang.Object
-
- com.rtfparserkit.parser.RtfListenerAdaptor
-
- com.rtfparserkit.converter.text.AbstractTextConverter
-
- All Implemented Interfaces:
IRtfListener
- Direct Known Subclasses:
StreamTextConverter,StringTextConverter
public abstract class AbstractTextConverter extends RtfListenerAdaptor
This class implements the core of a trivial RTF to text converter. Subclasses implement the processExtractedText method to determine how the extracted text is handled.
-
-
Field Summary
Fields Modifier and Type Field Description private CommandcurrentDestinationprivate java.util.Deque<Command>destinationStack
-
Constructor Summary
Constructors Constructor Description AbstractTextConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconvert(IRtfSource source)voidprocessCommand(Command command, int parameter, boolean hasParameter, boolean optional)Event raised by the RTF parser detailing a command read from the file.abstract voidprocessExtractedText(java.lang.String text)This method is called to process the test we've extracted from the RTF file.voidprocessGroupEnd()Event raised when the end of a group is encountered.voidprocessGroupStart()Event raised when the stat of a group is encountered.voidprocessString(java.lang.String string)Event raised by the RTF parser to pass string data.-
Methods inherited from class com.rtfparserkit.parser.RtfListenerAdaptor
processBinaryBytes, processCharacterBytes, processDocumentEnd, processDocumentStart
-
-
-
-
Method Detail
-
convert
public void convert(IRtfSource source) throws java.io.IOException
- Throws:
java.io.IOException
-
processExtractedText
public abstract void processExtractedText(java.lang.String text)
This method is called to process the test we've extracted from the RTF file.
-
processGroupStart
public void processGroupStart()
Description copied from interface:IRtfListenerEvent raised when the stat of a group is encountered.- Specified by:
processGroupStartin interfaceIRtfListener- Overrides:
processGroupStartin classRtfListenerAdaptor
-
processGroupEnd
public void processGroupEnd()
Description copied from interface:IRtfListenerEvent raised when the end of a group is encountered.- Specified by:
processGroupEndin interfaceIRtfListener- Overrides:
processGroupEndin classRtfListenerAdaptor
-
processString
public void processString(java.lang.String string)
Description copied from interface:IRtfListenerEvent raised by the RTF parser to pass string data. Note that the string has been created with the appropriate encoding and no further processing will be required.- Specified by:
processStringin interfaceIRtfListener- Overrides:
processStringin classRtfListenerAdaptor
-
processCommand
public void processCommand(Command command, int parameter, boolean hasParameter, boolean optional)
Description copied from interface:IRtfListenerEvent raised by the RTF parser detailing a command read from the file. The parameter argument details the optional integer parameter associated with the command. If the hasParameter flag is false, the parameter argument can be ignored. If the optional flag is set, this is a command which RTF readers can choose not to implement.- Specified by:
processCommandin interfaceIRtfListener- Overrides:
processCommandin classRtfListenerAdaptor
-
-