de.dante.extex.backend.documentWriter.postscript
Class AbstractPostscriptWriter

java.lang.Object
  extended byde.dante.extex.backend.documentWriter.postscript.AbstractPostscriptWriter
All Implemented Interfaces:
ColorAware, Configurable, DocumentWriter, MultipleDocumentStream, ResourceConsumer
Direct Known Subclasses:
EpsWriter, PsWriter

public abstract class AbstractPostscriptWriter
extends java.lang.Object
implements DocumentWriter, Configurable, MultipleDocumentStream, ResourceConsumer, ColorAware

This is the abstract base class for document writers producing PostScript code. Here some utility methods of general nature are collected.

Version:
$Revision: 1.8 $
Author:
Gerd Neugebauer

Constructor Summary
AbstractPostscriptWriter()
          Creates a new object.
 
Method Summary
 void configure(Configuration config)
          Configure an object according to a given Configuration.
protected  PsConverter getConverter(HeaderManager headerManager)
          Create a PostScript converter.
protected  java.lang.String getParameter(java.lang.String name)
          Getter for a named parameter.
protected  java.io.OutputStream newOutputStream(java.lang.String type)
          Acquire a new output stream.
 void setColorConverter(ColorConverter converter)
          Setter for the color converter.
 void setOutputStreamFactory(OutputStreamFactory factory)
          Setter for the output stream.
 void setParameter(java.lang.String name, java.lang.String value)
          Setter for a named parameter.
 void setResourceFinder(ResourceFinder resourceFinder)
          Setter for the resource finder.
protected  void writeDsc(java.io.OutputStream stream, java.lang.String name)
          Write a meta comment according to the Document Structuring Conventions.
protected  void writeDsc(java.io.OutputStream stream, java.lang.String name, java.lang.String value)
          Write a meta comment according to the Document Structuring Conventions.
protected  void writeFonts(java.io.OutputStream stream, FontManager fontManager)
          Write a meta comment according to the Document Structuring Conventions containing the DocumentFonts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.dante.extex.backend.documentWriter.DocumentWriter
close, getExtension, shipout
 

Constructor Detail

AbstractPostscriptWriter

public AbstractPostscriptWriter()
Creates a new object.

Method Detail

configure

public void configure(Configuration config)
               throws ConfigurationException
Description copied from interface: Configurable
Configure an object according to a given Configuration.

Specified by:
configure in interface Configurable
Parameters:
config - the configuration object to consider
Throws:
ConfigurationException - in case that something went wrong
See Also:
Configurable.configure( de.dante.util.framework.configuration.Configuration)

getParameter

protected java.lang.String getParameter(java.lang.String name)
Getter for a named parameter.

Parameters:
name - the name of the parameter
Returns:
the value of the parameter or null if none exists

getConverter

protected PsConverter getConverter(HeaderManager headerManager)
                            throws java.io.IOException
Create a PostScript converter.

Parameters:
headerManager - the header manager
Returns:
the new converter
Throws:
java.io.IOException - in case of an IO error

newOutputStream

protected java.io.OutputStream newOutputStream(java.lang.String type)
                                        throws DocumentWriterException
Acquire a new output stream.

Parameters:
type - the type for the reference to the configuration file
Returns:
the new output stream
Throws:
DocumentWriterException - in case of an error

setColorConverter

public void setColorConverter(ColorConverter converter)
Description copied from interface: ColorAware
Setter for the color converter.

Specified by:
setColorConverter in interface ColorAware
Parameters:
converter - the color converter
See Also:
ColorAware.setColorConverter( de.dante.extex.color.ColorConverter)

setOutputStreamFactory

public void setOutputStreamFactory(OutputStreamFactory factory)
Description copied from interface: MultipleDocumentStream
Setter for the output stream.

Specified by:
setOutputStreamFactory in interface MultipleDocumentStream
Parameters:
factory - the output stream
See Also:
MultipleDocumentStream.setOutputStreamFactory( de.dante.extex.backend.outputStream.OutputStreamFactory)

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Description copied from interface: DocumentWriter
Setter for a named parameter. Parameters are a general mechanism to influence the behavior of the document writer. Any parameter not known by the document writer has to be ignored.

Specified by:
setParameter in interface DocumentWriter
Parameters:
name - the name of the parameter
value - the value of the parameter
See Also:
DocumentWriter.setParameter( java.lang.String, java.lang.String)

setResourceFinder

public void setResourceFinder(ResourceFinder resourceFinder)
Description copied from interface: ResourceConsumer
Setter for the resource finder.

Specified by:
setResourceFinder in interface ResourceConsumer
Parameters:
resourceFinder - the resource finder
See Also:
ResourceConsumer.setResourceFinder( de.dante.util.resource.ResourceFinder)

writeDsc

protected void writeDsc(java.io.OutputStream stream,
                        java.lang.String name)
                 throws java.io.IOException
Write a meta comment according to the Document Structuring Conventions.

Parameters:
stream - the target stream to write to
name - the name of the DSC comment
Throws:
java.io.IOException - in case of an error during writing

writeDsc

protected void writeDsc(java.io.OutputStream stream,
                        java.lang.String name,
                        java.lang.String value)
                 throws java.io.IOException
Write a meta comment according to the Document Structuring Conventions.

Parameters:
stream - the target stream to write to
name - the name of the DSC comment
value - the value of the DSC comment
Throws:
java.io.IOException - in case of an error during writing

writeFonts

protected void writeFonts(java.io.OutputStream stream,
                          FontManager fontManager)
                   throws java.io.IOException
Write a meta comment according to the Document Structuring Conventions containing the DocumentFonts.

Parameters:
stream - the target stream to write to
fontManager - the font manager to ask for the fonts
Throws:
java.io.IOException - in case of an error during writing