Package org.apache.xmlgraphics.ps.dsc
Class DefaultDSCHandler
- java.lang.Object
-
- org.apache.xmlgraphics.ps.dsc.DefaultDSCHandler
-
- All Implemented Interfaces:
DSCHandler
public class DefaultDSCHandler extends java.lang.Object implements DSCHandler
Default implementation of a DSCHandler which simply passes through the PostScript content unchanged. Subclasses can implement different behaviour, for example to filter certain DSC comments or to insert PostScript code at specific places.
-
-
Field Summary
Fields Modifier and Type Field Description protected PSGeneratorgenprotected java.io.OutputStreamout
-
Constructor Summary
Constructors Constructor Description DefaultDSCHandler(java.io.OutputStream out)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomment(java.lang.String comment)Called for any line containing a full-line PostScript comment.voidendDocument()Called when the PostScript file is fully processed, i.e.voidhandleDSCComment(DSCComment comment)Called for each standard DSC comment.voidline(java.lang.String line)Called for a normal line of PostScript code.voidstartDocument(java.lang.String header)Called as a new PostScript file starts.
-
-
-
Field Detail
-
out
protected java.io.OutputStream out
-
gen
protected PSGenerator gen
-
-
Method Detail
-
startDocument
public void startDocument(java.lang.String header) throws java.io.IOExceptionDescription copied from interface:DSCHandlerCalled as a new PostScript file starts.- Specified by:
startDocumentin interfaceDSCHandler- Parameters:
header- the first line of the DSC-compliant file- Throws:
java.io.IOException- In case of an I/O error- See Also:
DSCHandler.startDocument(java.lang.String)
-
endDocument
public void endDocument() throws java.io.IOExceptionDescription copied from interface:DSCHandlerCalled when the PostScript file is fully processed, i.e. after the %%EOF comment.- Specified by:
endDocumentin interfaceDSCHandler- Throws:
java.io.IOException- In case of an I/O error- See Also:
DSCHandler.endDocument()
-
handleDSCComment
public void handleDSCComment(DSCComment comment) throws java.io.IOException
Description copied from interface:DSCHandlerCalled for each standard DSC comment. The classes passed to this method may be simple DSCComment classes or special subclasses for some of the DSC comments.- Specified by:
handleDSCCommentin interfaceDSCHandler- Parameters:
comment- the DSC comment- Throws:
java.io.IOException- In case of an I/O error- See Also:
DSCHandler.handleDSCComment( org.apache.xmlgraphics.ps.dsc.events.DSCComment)
-
line
public void line(java.lang.String line) throws java.io.IOExceptionDescription copied from interface:DSCHandlerCalled for a normal line of PostScript code.- Specified by:
linein interfaceDSCHandler- Parameters:
line- the line of code- Throws:
java.io.IOException- In case of an I/O error- See Also:
DSCHandler.line(java.lang.String)
-
comment
public void comment(java.lang.String comment) throws java.io.IOExceptionDescription copied from interface:DSCHandlerCalled for any line containing a full-line PostScript comment. This is also called for custom comments following the extension mechanism of the DSC specification.- Specified by:
commentin interfaceDSCHandler- Parameters:
comment- the comment line- Throws:
java.io.IOException- In case of an I/O error- See Also:
DSCHandler.comment(java.lang.String)
-
-