Class DSCTools

java.lang.Object
org.apache.xmlgraphics.ps.dsc.tools.DSCTools
All Implemented Interfaces:
DSCParserConstants

public final class DSCTools extends Object implements DSCParserConstants
Helper methods commonly used when dealing with DSC-compliant PostScript files.
  • Method Details

    • 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, 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
      IOException - In case of an I/O problem
    • nextPageOrTrailer

      public static DSCComment nextPageOrTrailer(DSCParser parser, PSGenerator gen) throws 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:
      IOException - In case of an I/O error
      DSCException - In case of a violation of the DSC spec