Class ChmParser


  • public class ChmParser
    extends java.lang.Object
    Reads the files that are extracted from a windows help ('.chm') file and creates a epublib Book out of it.
    • 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.FileObject findHhcFileObject​(org.apache.commons.vfs2.FileObject chmRootDir)  
      private static Resources findResources​(org.apache.commons.vfs2.FileObject rootDir, java.lang.String inputEncoding)  
      protected static java.lang.String findTitle​(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 Book parseChm​(org.apache.commons.vfs2.FileObject chmRootDir)  
      static Book parseChm​(org.apache.commons.vfs2.FileObject chmRootDir, java.lang.String inputHtmlEncoding)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • ChmParser

        public ChmParser()
    • 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.XPathExpressionException
        java.io.IOException
        javax.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.IOException
        javax.xml.parsers.ParserConfigurationException
        javax.xml.xpath.XPathExpressionException
      • findTitle

        protected static java.lang.String findTitle​(org.apache.commons.vfs2.FileObject chmRootDir)
                                             throws java.io.IOException
        Finds 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