Class DSCTools
java.lang.Object
org.apache.xmlgraphics.ps.dsc.tools.DSCTools
- All Implemented Interfaces:
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
Modifier and TypeMethodDescriptionstatic 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.
-
Method Details
-
headerCommentsEndHere
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 specIOException
- 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 parsergen
- 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 errorDSCException
- In case of a violation of the DSC spec
-