Class 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 Detail

      • currentDestination

        private Command currentDestination
      • destinationStack

        private final java.util.Deque<Command> destinationStack
    • Constructor Detail

      • AbstractTextConverter

        public AbstractTextConverter()
    • 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.
      • processString

        public void processString​(java.lang.String string)
        Description copied from interface: IRtfListener
        Event 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:
        processString in interface IRtfListener
        Overrides:
        processString in class RtfListenerAdaptor
      • processCommand

        public void processCommand​(Command command,
                                   int parameter,
                                   boolean hasParameter,
                                   boolean optional)
        Description copied from interface: IRtfListener
        Event 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:
        processCommand in interface IRtfListener
        Overrides:
        processCommand in class RtfListenerAdaptor