Class EpubModule

  • All Implemented Interfaces:
    Module

    public class EpubModule
    extends ModuleBase
    Module for validation and metadata extraction on EPUB files. Validation is performed by EPUBCheck https://github.com/w3c/epubcheck/ This module uses the metadata produced by EPUBCheck to produce a JHOVE report.
    Author:
    Karen Hanson
    • Field Detail

      • NOTWELLFORMED_ERRCODES

        public static final String[] NOTWELLFORMED_ERRCODES
      • _metadata

        protected Property _metadata
    • Constructor Detail

      • EpubModule

        public EpubModule()
        Instantiate a EpubModule object using default properties
      • EpubModule

        public EpubModule​(String name,
                          String release,
                          int[] date,
                          String[] format,
                          String coverage,
                          String[] mimetype,
                          String wellformedNote,
                          String validityNote,
                          String repinfoNote,
                          String note,
                          String rights,
                          boolean isRandomAccess,
                          Agent moduleAgent)
        Instantiate a EpubModule object using constructor arguments
        Parameters:
        name -
        release -
        date -
        format -
        coverage -
        mimetype -
        wellformedNote -
        validityNote -
        repinfoNote -
        note -
        rights -
        isRandomAccess -
        moduleAgent -
    • Method Detail

      • initializeInstance

        protected void initializeInstance​(Agent moduleAgent)
        Initialize core properties - module Agent, format specification Document, and format Signature
        Parameters:
        agentName -
        agentType -
        agentAddress -
        agentTelephone -
        agentEmail -
      • parse

        public int parse​(InputStream stream,
                         RepInfo info,
                         int parseIndex)
                  throws IOException
        Parse the content of a purported EPUB file and store the results in RepInfo.
        Specified by:
        parse in interface Module
        Overrides:
        parse in class ModuleBase
        Parameters:
        stream - An InputStream, positioned at its beginning, which is generated from the object to be parsed. If multiple calls to parse are made on the basis of a nonzero value being returned, a new InputStream must be provided each time.
        info - A fresh (on the first call) RepInfo object which will be modified to reflect the results of the parsing If multiple calls to parse are made on the basis of a nonzero value being returned, the same RepInfo object should be passed with each call.
        parseIndex - Must be 0 in first call to parse. If parse returns a nonzero value, it must be called again with parseIndex equal to that return value.
        Returns:
        Throws:
        IOException
      • toUtf8

        public static String toUtf8​(String inputString)
        Make sure the string contains valid UTF-8 characters
        Parameters:
        inputString -
        Returns:
        escaped String