org.apache.xmlgraphics.ps.dsc

## Class EventRecorder

- java.lang.Object
- - org.apache.xmlgraphics.ps.dsc.EventRecorder

- All Implemented Interfaces:
    DSCHandler

      public class EventRecorder
      extends java.lang.Object
      implements DSCHandler

  DSCHandler implementation that records DSC events.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EventRecorder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `comment(java.lang.String comment)` Called for any line containing a full-line PostScript comment.
    `void` | `endDocument()` Called when the PostScript file is fully processed, i.e.
    `void` | `handleDSCComment(DSCComment comment)` Called for each standard DSC comment.
    `void` | `line(java.lang.String line)` Called for a normal line of PostScript code.
    `void` | `replay(DSCHandler handler)` Replays the recorded events to a specified DSCHandler instance.
    `void` | `startDocument(java.lang.String header)` Called as a new PostScript file starts.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EventRecorder

          public EventRecorder()

  - ### Method Detail

    - #### replay

          public void replay(DSCHandler handler)
                      throws java.io.IOException

      Replays the recorded events to a specified DSCHandler instance.
      Parameters:
        `handler` - the DSCHandler to send the recorded events to
      Throws:
        `java.io.IOException` - In case of an I/O error

    - #### comment

          public void comment(java.lang.String comment)
                       throws java.io.IOException

      Description copied from interface: `DSCHandler`
      Called for any line containing a full-line PostScript comment. This is also called for custom comments following the extension mechanism of the DSC specification.
      Specified by:
        `comment` in interface `DSCHandler`
      Parameters:
        `comment` - the comment line
      Throws:
        `java.io.IOException` - In case of an I/O error
      See Also:
        `DSCHandler.comment(java.lang.String)`

    - #### handleDSCComment

          public void handleDSCComment(DSCComment comment)
                                throws java.io.IOException

      Description copied from interface: `DSCHandler`
      Called for each standard DSC comment. The classes passed to this method may be simple DSCComment classes or special subclasses for some of the DSC comments.
      Specified by:
        `handleDSCComment` in interface `DSCHandler`
      Parameters:
        `comment` - the DSC comment
      Throws:
        `java.io.IOException` - In case of an I/O error
      See Also:
        `DSCHandler.handleDSCComment( org.apache.xmlgraphics.ps.dsc.events.DSCComment)`

    - #### line

          public void line(java.lang.String line)
                    throws java.io.IOException

      Description copied from interface: `DSCHandler`
      Called for a normal line of PostScript code.
      Specified by:
        `line` in interface `DSCHandler`
      Parameters:
        `line` - the line of code
      Throws:
        `java.io.IOException` - In case of an I/O error
      See Also:
        `DSCHandler.line(java.lang.String)`

    - #### startDocument

          public void startDocument(java.lang.String header)
                             throws java.io.IOException

      Description copied from interface: `DSCHandler`
      Called as a new PostScript file starts.
      Specified by:
        `startDocument` in interface `DSCHandler`
      Parameters:
        `header` - the first line of the DSC-compliant file
      Throws:
        `java.io.IOException` - In case of an I/O error
      See Also:
        `DSCHandler.startDocument(java.lang.String)`

    - #### endDocument

          public void endDocument()
                           throws java.io.IOException

      Description copied from interface: `DSCHandler`
      Called when the PostScript file is fully processed, i.e. after the %%EOF comment.
      Specified by:
        `endDocument` in interface `DSCHandler`
      Throws:
        `java.io.IOException` - In case of an I/O error
      See Also:
        `DSCHandler.endDocument()`

Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.