Package org.ithaka.portico.jhove.module
Class EpubModule
- java.lang.Object
-
- edu.harvard.hul.ois.jhove.ModuleBase
-
- org.ithaka.portico.jhove.module.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 Summary
Fields Modifier and Type Field Description protected Property_metadataprotected List<Property>_propListstatic String[]NOTWELLFORMED_ERRCODES-
Fields inherited from class edu.harvard.hul.ois.jhove.ModuleBase
_app, _bigEndian, _checksumFinished, _ckSummer, _countStream, _coverage, _crc32, _cstream, _date, _defaultParams, _dstream, _features, _format, _init, _isRandomAccess, _je, _logger, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _sha256, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNote
-
Fields inherited from interface edu.harvard.hul.ois.jhove.Module
MAXIMUM_VERBOSITY, MINIMUM_VERBOSITY
-
-
Constructor Summary
Constructors Constructor Description EpubModule()Instantiate a EpubModule object using default propertiesEpubModule(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
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckSignatures(File file, InputStream stream, RepInfo info)protected voidinitializeInstance(Agent moduleAgent)protected voidinitParse()intparse(InputStream stream, RepInfo info, int parseIndex)Parse the content of a purported EPUB file and store the results in RepInfo.voidparse(RandomAccessFile file, RepInfo info)protected voidsetupDataStream(InputStream stream, RepInfo info)static StringtoUtf8(String inputString)Make sure the string contains valid UTF-8 characters-
Methods inherited from class edu.harvard.hul.ois.jhove.ModuleBase
addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, checksumIfRafNotCopied, getApp, getBase, getBufferedDataStream, getCoverage, getCRC32, getDate, getDefaultParams, getFeatures, getFormat, getMimeType, getName, getNByte, getNote, getRelease, getRepInfoNote, getRights, getSignature, getSpecification, getValidityNote, getVendor, getWellFormedNote, hasFeature, init, initFeatures, initInfo, isBigEndian, isParamInDefaults, isRandomAccess, param, readByteBuf, readDouble, readDouble, readDouble, readFloat, readFloat, readSignedByte, readSignedByte, readSignedByte, readSignedInt, readSignedInt, readSignedInt, readSignedLong, readSignedRational, readSignedRational, readSignedShort, readSignedShort, readSignedShort, readUnsignedByte, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedInt, readUnsignedRational, readUnsignedRational, readUnsignedRational, readUnsignedShort, readUnsignedShort, readUnsignedShort, resetParams, setApp, setBase, setChecksums, setCRC32, setDefaultParams, setMD5, setNByte, setSHA1, setSHA256, setValidityNote, setVerbosity, show, skipBytes, skipBytes, skipDstreamToEnd, vectorToPropArray
-
-
-
-
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)
- Parameters:
agentName-agentType-agentAddress-agentTelephone-agentEmail-
-
setupDataStream
protected void setupDataStream(InputStream stream, RepInfo info)
- Overrides:
setupDataStreamin classModuleBase
-
checkSignatures
public void checkSignatures(File file, InputStream stream, RepInfo info) throws IOException
- Specified by:
checkSignaturesin interfaceModule- Overrides:
checkSignaturesin classModuleBase- Throws:
IOException
-
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:
parsein interfaceModule- Overrides:
parsein classModuleBase- Parameters:
stream- An InputStream, positioned at its beginning, which is generated from the object to be parsed. If multiple calls toparseare 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 toparseare 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 toparse. Ifparsereturns a nonzero value, it must be called again withparseIndexequal to that return value.- Returns:
- Throws:
IOException
-
parse
public void parse(RandomAccessFile file, RepInfo info) throws IOException
- Specified by:
parsein interfaceModule- Overrides:
parsein classModuleBase- Throws:
IOException
-
toUtf8
public static String toUtf8(String inputString)
Make sure the string contains valid UTF-8 characters- Parameters:
inputString-- Returns:
- escaped String
-
initParse
protected void initParse()
- Overrides:
initParsein classModuleBase
-
-