org.apache.xmlgraphics.ps.dsc.tools

## Class DSCTools

- java.lang.Object
- - org.apache.xmlgraphics.ps.dsc.tools.DSCTools

- All Implemented Interfaces:
    DSCParserConstants

      public final class DSCTools
      extends java.lang.Object
      implements DSCParserConstants

  Helper methods commonly used when dealing with DSC-compliant PostScript files.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.xmlgraphics.ps.dsc.DSCParserConstants

      `COMMENT, DSC_COMMENT, EOF, HEADER_COMMENT, LINE`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DSCHeaderComment` | `checkAndSkipDSC30Header(DSCParser parser)` Verifies that the file being parsed is a DSC 3.0 file.
    `static boolean` | `headerCommentsEndHere(DSCEvent event)` Indicates whether the given event ends a header comment section according to the rules in DSC 3.0, chapter 4.4.
    `static DSCComment` | `nextPageOrTrailer(DSCParser parser, PSGenerator gen)` Advances the parser to the next page or to the trailer or the end of file comment.

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

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

- - ### Method Detail

    - #### headerCommentsEndHere

          public static boolean headerCommentsEndHere(DSCEvent event)

      Indicates whether the given event ends a header comment section according to the rules in DSC 3.0, chapter 4.4.
      Parameters:
        `event` - the event to check
      Returns:
        true if a header comment section would be ended either explicitely or implicitely by the given event

    - #### checkAndSkipDSC30Header

          public static DSCHeaderComment checkAndSkipDSC30Header(DSCParser parser)
                                                          throws DSCException,
                                                                 java.io.IOException

      Verifies that the file being parsed is a DSC 3.0 file.
      Parameters:
        `parser` - the DSC parser
      Returns:
        the header comment event
      Throws:
        `DSCException` - In case of a violation of the DSC spec
        `java.io.IOException` - In case of an I/O problem

    - #### nextPageOrTrailer

          public static DSCComment nextPageOrTrailer(DSCParser parser,
                                                     PSGenerator gen)
                                              throws java.io.IOException,
                                                     DSCException

      Advances the parser to the next page or to the trailer or the end of file comment.
      Parameters:
        `parser` - the DSC parser
        `gen` - the PSGenerator instance to pass the skipped events through to
      Returns:
        the DSC comment found (Page, Trailer or EOF)
      Throws:
        `java.io.IOException` - In case of an I/O error
        `DSCException` - In case of a violation of the DSC spec

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