Class RtfDumpListener

  • All Implemented Interfaces:
    IRtfListener

    public class RtfDumpListener
    extends java.lang.Object
    implements IRtfListener
    Trivial class used to convert events generated by an RTF parser into an XML document. The primary purpose of this code is to debug the parser output, and provide a convenient method for comparing expected and actual parser behaviour in test cases.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.xml.stream.XMLStreamWriter writer  
    • Constructor Summary

      Constructors 
      Constructor Description
      RtfDumpListener​(java.io.OutputStream stream)
      Constructor.
    • Field Detail

      • writer

        private final javax.xml.stream.XMLStreamWriter writer
    • Constructor Detail

      • RtfDumpListener

        public RtfDumpListener​(java.io.OutputStream stream)
                        throws javax.xml.stream.XMLStreamException
        Constructor.
        Throws:
        javax.xml.stream.XMLStreamException
    • Method Detail

      • processCharacterBytes

        public void processCharacterBytes​(byte[] data)
        Write character bytes - note that we cheat, we just convert them directly to a string for output with no regard to the encoding.
        Specified by:
        processCharacterBytes in interface IRtfListener
      • processBinaryBytes

        public void processBinaryBytes​(byte[] data)
        Write binary data as hex.
        Specified by:
        processBinaryBytes in interface IRtfListener
      • processCommand

        public void processCommand​(Command command,
                                   int parameter,
                                   boolean hasParameter,
                                   boolean optional)
        Write a command tag.
        Specified by:
        processCommand in interface IRtfListener
      • processString

        public void processString​(java.lang.String string)
        Write string data.
        Specified by:
        processString in interface IRtfListener