Class EpubWriter


  • public class EpubWriter
    extends java.lang.Object
    Generates an epub file. Not thread-safe, single use object.
    • Field Detail

      • log

        private static final org.slf4j.Logger log
      • EMPTY_NAMESPACE_PREFIX

        static final java.lang.String EMPTY_NAMESPACE_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • EpubWriter

        public EpubWriter()
    • Method Detail

      • write

        public void write​(Book book,
                          java.io.OutputStream out)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • processBook

        private Book processBook​(Book book)
      • initTOCResource

        private void initTOCResource​(Book book)
      • writeResources

        private void writeResources​(Book book,
                                    java.util.zip.ZipOutputStream resultStream)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeResource

        private void writeResource​(Resource resource,
                                   java.util.zip.ZipOutputStream resultStream)
                            throws java.io.IOException
        Writes the resource to the resultStream.
        Parameters:
        resource -
        resultStream -
        Throws:
        java.io.IOException
      • writePackageDocument

        private void writePackageDocument​(Book book,
                                          java.util.zip.ZipOutputStream resultStream)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeContainer

        private void writeContainer​(java.util.zip.ZipOutputStream resultStream)
                             throws java.io.IOException
        Writes the META-INF/container.xml file.
        Parameters:
        resultStream -
        Throws:
        java.io.IOException
      • writeMimeType

        private void writeMimeType​(java.util.zip.ZipOutputStream resultStream)
                            throws java.io.IOException
        Stores the mimetype as an uncompressed file in the ZipOutputStream.
        Parameters:
        resultStream -
        Throws:
        java.io.IOException
      • calculateCrc

        private long calculateCrc​(byte[] data)
      • getNcxId

        java.lang.String getNcxId()
      • getNcxHref

        java.lang.String getNcxHref()
      • getNcxMediaType

        java.lang.String getNcxMediaType()
      • setBookProcessor

        public void setBookProcessor​(BookProcessor bookProcessor)