| |
|
| java.lang.Object org.apache.xmlgraphics.ps.dsc.DSCParser
DSCParser | public class DSCParser implements DSCParserConstants(Code) | | Parser for DSC-compliant PostScript files (DSC = Document Structuring Conventions). The parser
is implemented as a pull parser but has the ability to act as a push parser through the
DSCHandler interface.
|
DSCParser | public DSCParser(InputStream in) throws IOException, DSCException(Code) | | Creates a new DSC parser.
Parameters: in - InputStream to read the PostScript file from(the stream is not closed by this class, the caller is responsible for that) throws: IOException - In case of an I/O error throws: DSCException - In case of a violation of the DSC spec |
getCurrentEvent | public DSCEvent getCurrentEvent()(Code) | | Returns the current event.
the current event |
getInputStream | public InputStream getInputStream()(Code) | | Returns the InputStream the PostScript code is read from.
the InputStream the PostScript code is read from |
getLine | public String getLine()(Code) | | Returns the current PostScript line.
the current PostScript line throws: IllegalStateException - if the current event is not a normal PostScript line |
hasNext | public boolean hasNext()(Code) | | Indicates whether there are additional items.
true if there are additonal items, false if the end of the file has been reached |
nextDSCComment | public DSCComment nextDSCComment(String name) throws IOException, DSCException(Code) | | Advances to the next DSC comment with the given name.
Parameters: name - the name of the DSC comment the requested DSC comment or null if the end of the file is reached throws: IOException - In case of an I/O error throws: DSCException - In case of a violation of the DSC spec |
nextDSCComment | public DSCComment nextDSCComment(String name, PSGenerator gen) throws IOException, DSCException(Code) | | Advances to the next DSC comment with the given name.
Parameters: name - the name of the DSC comment Parameters: gen - PSGenerator to pass the skipped events though to the requested DSC comment or null if the end of the file is reached throws: IOException - In case of an I/O error throws: DSCException - In case of a violation of the DSC spec |
nextPSComment | public PostScriptComment nextPSComment(String prefix, PSGenerator gen) throws IOException, DSCException(Code) | | Advances to the next PostScript comment with the given prefix. This is used to find
comments following the DSC extension mechanism.
Example: To find FOP's custom comments, pass in "FOP" as a prefix. This will find comments
like "%FOPFontSetup".
Parameters: prefix - the prefix of the extension comment Parameters: gen - PSGenerator to pass the skipped events though to the requested PostScript comment or null if the end of the file is reached throws: IOException - In case of an I/O error throws: DSCException - In case of a violation of the DSC spec |
parse | public void parse(DSCHandler handler) throws IOException, DSCException(Code) | | Starts the parser in push parsing mode sending events to the DSCHandler instance.
Parameters: handler - the DSCHandler instance to send the events to throws: IOException - In case of an I/O error throws: DSCException - In case of a violation of the DSC spec |
peek | public DSCEvent peek()(Code) | | Returns the next event without moving the cursor to the next event.
the next event |
setFilter | public void setFilter(DSCFilter filter)(Code) | | Sets a filter for DSC events.
Parameters: filter - the filter to use or null to disable filtering |
setNestedDocumentHandler | public void setNestedDocumentHandler(NestedDocumentHandler handler)(Code) | | Sets a NestedDocumentHandler which is used to skip nested documents like embedded EPS files.
You can also process those parts in a special way.
Parameters: handler - the NestedDocumentHandler instance or null to disable the feature |
warn | protected void warn(String msg)(Code) | | This method is used to write out warning messages for the parsing process. Subclass to
override this method. The default implementation writes to System.err.
Parameters: msg - the warning message |
|
|
|