Class AFPStreamer

java.lang.Object
org.apache.fop.afp.AFPStreamer
All Implemented Interfaces:
Streamable

public class AFPStreamer extends Object implements Streamable
Manages the streaming of the AFP output
  • Field Details

    • LOG

      private static final org.apache.commons.logging.Log LOG
      Static logging instance
    • DEFAULT_EXTERNAL_RESOURCE_FILENAME

      private static final String DEFAULT_EXTERNAL_RESOURCE_FILENAME
      See Also:
    • TEMP_URI_GENERATOR

      private static final org.apache.xmlgraphics.io.TempResourceURIGenerator TEMP_URI_GENERATOR
    • factory

      private final Factory factory
    • resourceResolver

      private final InternalResourceResolver resourceResolver
    • pathResourceGroupMap

      private final Map<URI,ResourceGroup> pathResourceGroupMap
      A mapping of external resource destinations to resource groups
    • printFileResourceGroup

      private StreamedResourceGroup printFileResourceGroup
    • defaultResourceGroupUri

      private URI defaultResourceGroupUri
      Sets the default resource group file path
    • tempUri

      private final URI tempUri
    • tempOutputStream

      private OutputStream tempOutputStream
      temporary document outputstream
    • outputStream

      private OutputStream outputStream
      the final outputstream
    • dataStream

      private DataStream dataStream
  • Constructor Details

    • AFPStreamer

      public AFPStreamer(Factory factory, InternalResourceResolver resourceResolver)
      Main constructor
      Parameters:
      factory - a factory
      resourceResolver - resource resolver
  • Method Details

    • createDataStream

      public DataStream createDataStream(AFPPaintingState paintingState) throws IOException
      Creates a new DataStream
      Parameters:
      paintingState - the AFP painting state
      Returns:
      a new DataStream
      Throws:
      IOException - thrown if an I/O exception of some sort has occurred
    • setDefaultResourceGroupUri

      public void setDefaultResourceGroupUri(URI uri)
      Sets the default resource group URI.
      Parameters:
      uri - the default resource group URI
    • getResourceGroup

      public ResourceGroup getResourceGroup(AFPResourceLevel level)
      Returns the resource group for a given resource info
      Parameters:
      level - a resource level
      Returns:
      a resource group for the given resource info
    • close

      public void close() throws IOException
      Closes off the AFP stream writing the document stream
      Throws:
      IOException - if an an I/O exception of some sort has occurred
    • setOutputStream

      public void setOutputStream(OutputStream outputStream)
      Sets the final outputstream
      Parameters:
      outputStream - an outputstream
    • writeToStream

      public void writeToStream(OutputStream os) throws IOException
      DataStream objects must implement the writeToStream() method to write its data to the given OutputStream
      Specified by:
      writeToStream in interface Streamable
      Parameters:
      os - the outputsteam stream
      Throws:
      IOException - an I/O exception of some sort has occurred.