Class OneNoteParser
- java.lang.Object
-
- org.apache.tika.parser.AbstractParser
-
- org.apache.tika.parser.microsoft.onenote.OneNoteParser
-
- All Implemented Interfaces:
Serializable
,Parser
public class OneNoteParser extends AbstractParser
OneNote tika parser capable of parsing Microsoft OneNote files.Based on the Microsoft specs MS-ONE and MS-ONESTORE.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ONE_NOTE_PREFIX
-
Constructor Summary
Constructors Constructor Description OneNoteParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.tika.parser.microsoft.onenote.OneNoteDocument
createOneNoteDocumentFromDirectFileResource(org.apache.tika.parser.microsoft.onenote.OneNoteDirectFileResource oneNoteDirectFileResource)
Create a OneNoteDocument object.Set<MediaType>
getSupportedTypes(ParseContext context)
Returns the set of media types supported by this parser when used with the given parse context.void
parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)
Parses a document stream into a sequence of XHTML SAX events.-
Methods inherited from class org.apache.tika.parser.AbstractParser
parse
-
-
-
-
Field Detail
-
ONE_NOTE_PREFIX
public static final String ONE_NOTE_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSupportedTypes
public Set<MediaType> getSupportedTypes(ParseContext context)
Description copied from interface:Parser
Returns the set of media types supported by this parser when used with the given parse context.- Parameters:
context
- parse context- Returns:
- immutable set of media types
-
parse
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
Description copied from interface:Parser
Parses a document stream into a sequence of XHTML SAX events. Fills in related document metadata in the given metadata object.The given document stream is consumed but not closed by this method. The responsibility to close the stream remains on the caller.
Information about the parsing context can be passed in the context parameter. See the parser implementations for the kinds of context information they expect.
- Parameters:
stream
- the document stream (input)handler
- handler for the XHTML SAX events (output)metadata
- document metadata (input and output)context
- parse context- Throws:
IOException
- if the document stream could not be readSAXException
- if the SAX events could not be processedTikaException
- if the document could not be parsed
-
createOneNoteDocumentFromDirectFileResource
public org.apache.tika.parser.microsoft.onenote.OneNoteDocument createOneNoteDocumentFromDirectFileResource(org.apache.tika.parser.microsoft.onenote.OneNoteDirectFileResource oneNoteDirectFileResource) throws IOException, 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.TikaException
-
-