Class MultiFileRenderingUtil


  • public class MultiFileRenderingUtil
    extends java.lang.Object
    This utility class helps renderers who generate one file per page, like the PNG renderer.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String fileExtension  
      private java.lang.String filePrefix
      The file syntax prefix, eg.
      private java.io.File outputDir
      The output directory where images are to be written
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiFileRenderingUtil​(java.lang.String ext, java.io.File outputFile)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.OutputStream createOutputStream​(int pageNumber)
      Creates a new OutputStream for the given page number.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • filePrefix

        private java.lang.String filePrefix
        The file syntax prefix, eg. "page" will output "page1.png" etc
      • fileExtension

        private java.lang.String fileExtension
      • outputDir

        private java.io.File outputDir
        The output directory where images are to be written
    • Constructor Detail

      • MultiFileRenderingUtil

        public MultiFileRenderingUtil​(java.lang.String ext,
                                      java.io.File outputFile)
        Creates a new instance.

        The file name must not have an extension, or must have extension "png", and its last period must not be at the start (empty file prefix).

        Parameters:
        ext - the extension to be used
        outputFile - the output file or null if there's no such information
    • Method Detail

      • createOutputStream

        public java.io.OutputStream createOutputStream​(int pageNumber)
                                                throws java.io.IOException
        Creates a new OutputStream for the given page number.
        Parameters:
        pageNumber - the page number (zero-based)
        Returns:
        the output stream for the page
        Throws:
        java.io.IOException - if there's an I/O error while setting up the output stream