Class EpubReader


  • public class EpubReader
    extends java.lang.Object
    Reads an epub file.
    • Field Detail

      • log

        private static final org.slf4j.Logger log
    • Constructor Detail

      • EpubReader

        public EpubReader()
    • Method Detail

      • readEpub

        public Book readEpub​(java.io.InputStream in)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(ZipInputStream in)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(ZipFile zipfile)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(java.io.InputStream in,
                             java.lang.String encoding)
                      throws java.io.IOException
        Read epub from inputstream
        Parameters:
        in - the inputstream from which to read the epub
        encoding - the encoding to use for the html files within the epub
        Returns:
        the Book as read from the inputstream
        Throws:
        java.io.IOException
      • readEpubLazy

        public Book readEpubLazy​(ZipFile zipFile,
                                 java.lang.String encoding)
                          throws java.io.IOException
        Reads this EPUB without loading any resources into memory.
        Parameters:
        zipFile - the file to load
        encoding - the encoding for XHTML files
        Returns:
        this Book without loading all resources into memory.
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(ZipInputStream in,
                             java.lang.String encoding)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(ZipFile in,
                             java.lang.String encoding)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpubLazy

        public Book readEpubLazy​(ZipFile zipFile,
                                 java.lang.String encoding,
                                 java.util.List<MediaType> lazyLoadedTypes)
                          throws java.io.IOException
        Reads this EPUB without loading all resources into memory.
        Parameters:
        zipFile - the file to load
        encoding - the encoding for XHTML files
        lazyLoadedTypes - a list of the MediaType to load lazily
        Returns:
        this Book without loading all resources into memory.
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(Resources resources)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readEpub

        public Book readEpub​(Resources resources,
                             Book result)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • postProcessBook

        private Book postProcessBook​(Book book)
      • processNcxResource

        private Resource processNcxResource​(Resource packageResource,
                                            Book book)
      • processPackageResource

        private Resource processPackageResource​(java.lang.String packageResourceHref,
                                                Book book,
                                                Resources resources)
      • getPackageResourceHref

        private java.lang.String getPackageResourceHref​(Resources resources)
      • handleMimeType

        private void handleMimeType​(Book result,
                                    Resources resources)