Package nl.siegmann.epublib.chm
Class ChmParser
- java.lang.Object
-
- nl.siegmann.epublib.chm.ChmParser
-
public class ChmParser extends java.lang.ObjectReads the files that are extracted from a windows help ('.chm') file and creates a epublib Book out of it.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_CHM_HTML_INPUT_ENCODINGstatic intMINIMAL_SYSTEM_TITLE_LENGTH
-
Constructor Summary
Constructors Constructor Description ChmParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static org.apache.commons.vfs2.FileObjectfindHhcFileObject(org.apache.commons.vfs2.FileObject chmRootDir)private static ResourcesfindResources(org.apache.commons.vfs2.FileObject rootDir, java.lang.String inputEncoding)protected static java.lang.StringfindTitle(org.apache.commons.vfs2.FileObject chmRootDir)Finds in the '#SYSTEM' file the 3rd set of characters that have ascii value >= 32 and >= 126 and is more than 3 characters long.static BookparseChm(org.apache.commons.vfs2.FileObject chmRootDir)static BookparseChm(org.apache.commons.vfs2.FileObject chmRootDir, java.lang.String inputHtmlEncoding)
-
-
-
Field Detail
-
DEFAULT_CHM_HTML_INPUT_ENCODING
public static final java.lang.String DEFAULT_CHM_HTML_INPUT_ENCODING
- See Also:
- Constant Field Values
-
MINIMAL_SYSTEM_TITLE_LENGTH
public static final int MINIMAL_SYSTEM_TITLE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseChm
public static Book parseChm(org.apache.commons.vfs2.FileObject chmRootDir) throws javax.xml.xpath.XPathExpressionException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.xpath.XPathExpressionExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationException
-
parseChm
public static Book parseChm(org.apache.commons.vfs2.FileObject chmRootDir, java.lang.String inputHtmlEncoding) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, javax.xml.xpath.XPathExpressionException
- Throws:
java.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionjavax.xml.xpath.XPathExpressionException
-
findTitle
protected static java.lang.String findTitle(org.apache.commons.vfs2.FileObject chmRootDir) throws java.io.IOExceptionFinds in the '#SYSTEM' file the 3rd set of characters that have ascii value >= 32 and >= 126 and is more than 3 characters long. Assumes that that is then the title of the book.- Parameters:
chmRootDir-- Returns:
- Finds in the '#SYSTEM' file the 3rd set of characters that have ascii value >= 32 and >= 126 and is more than 3 characters long.
- Throws:
java.io.IOException
-
findHhcFileObject
private static org.apache.commons.vfs2.FileObject findHhcFileObject(org.apache.commons.vfs2.FileObject chmRootDir) throws org.apache.commons.vfs2.FileSystemException- Throws:
org.apache.commons.vfs2.FileSystemException
-
findResources
private static Resources findResources(org.apache.commons.vfs2.FileObject rootDir, java.lang.String inputEncoding) throws java.io.IOException
- Throws:
java.io.IOException
-
-