Class 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.
    • 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