Class OneNoteParser

  • All Implemented Interfaces:
    Serializable, org.apache.tika.parser.Parser

    public class OneNoteParser
    extends Object
    implements org.apache.tika.parser.Parser
    OneNote tika parser capable of parsing Microsoft OneNote files.

    Based on the Microsoft specs MS-ONE and MS-ONESTORE.

    See Also:
    Serialized Form
    • Constructor Detail

      • OneNoteParser

        public OneNoteParser()
    • Method Detail

      • getSupportedTypes

        public Set<org.apache.tika.mime.MediaType> getSupportedTypes​(org.apache.tika.parser.ParseContext context)
        Specified by:
        getSupportedTypes in interface org.apache.tika.parser.Parser
      • parse

        public void parse​(InputStream stream,
                          ContentHandler handler,
                          org.apache.tika.metadata.Metadata metadata,
                          org.apache.tika.parser.ParseContext context)
                   throws IOException,
                          SAXException,
                          org.apache.tika.exception.TikaException
        Specified by:
        parse in interface org.apache.tika.parser.Parser
        Throws:
        IOException
        SAXException
        org.apache.tika.exception.TikaException
      • createOneNoteDocumentFromDirectFileResource

        public org.apache.tika.parser.microsoft.onenote.OneNoteDocument createOneNoteDocumentFromDirectFileResource​(org.apache.tika.parser.microsoft.onenote.OneNoteDirectFileResource oneNoteDirectFileResource)
                                                                                                             throws IOException,
                                                                                                                    org.apache.tika.exception.TikaException
        Create a OneNoteDocument object.

        This won't actually have the binary data of the sections, but it's more of a metadata structure that contains the general structure of the container and contains offset positions of where to find the binary data we care about.

        OneNote files are of format:

        The header (section 2.3.1 in MS-ONESTORE) is the first 1024 bytes of the file. It contains references to the other structures in the file as well as metadata about the file. The free chunk list (section 2.3.2 in MS-ONESTORE) defines where there are free spaces in the file where data can be written. The transaction log (section 2.3.3 in MS-ONESTORE) stores the state and length of each file node list (section 2.4 in MS-ONESTORE) in the file. The hashed chunk list (section 2.3.4 in MS-ONESTORE) stores read-only objects in the file that can be referenced by multiple revisions (section 2.1.8 in MS-ONESTORE). The root file node list (section 2.1.14 in MS-ONESTORE) is the file node list that is the root of the tree of all file node lists in the file.

        In this method we first parse the header.

        After parsing the header, this results in header.fcrFileNodeListRoot that points to the first

        Parameters:
        oneNoteDirectFileResource - A random access file resource used as the source of the content.
        Returns:
        A parsed one note document. This document does not contain any of the binary data, rather it just contains the data pointers and metadata.
        Throws:
        IOException - Will throw IOException in typical IO issue situations.
        org.apache.tika.exception.TikaException