public class OneNoteParser extends AbstractParser
Based on the Microsoft specs MS-ONE and MS-ONESTORE.
Constructor and Description |
---|
OneNoteParser() |
Modifier and Type | Method and 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.
|
parse
public Set<MediaType> getSupportedTypes(ParseContext context)
Parser
context
- parse contextpublic void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
Parser
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.
stream
- the document stream (input)handler
- handler for the XHTML SAX events (output)metadata
- document metadata (input and output)context
- parse contextIOException
- if the document stream could not be readSAXException
- if the SAX events could not be processedTikaException
- if the document could not be parsedpublic org.apache.tika.parser.microsoft.onenote.OneNoteDocument createOneNoteDocumentFromDirectFileResource(org.apache.tika.parser.microsoft.onenote.OneNoteDirectFileResource oneNoteDirectFileResource) throws IOException, TikaException
This won't actually have the binary data of any 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
oneNoteDirectFileResource
- A random access file resource used as the source of the content.IOException
- Will throw IOException in typical IO issue situations.TikaException
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.