Home » Tika Extracting Jar File

Tika Extracting Jar File

by Online Tutorials Library

Tika Jar File Extraction

To extract Jar (Java ARchive) file, Tika provides PackageParser class. This class is used to extract content and metadata from the Jar file. It is located into the org.apache.tika.parser.pkg package and contains various constructors and methods that are tabled below.

Tika PackageParser Constructor

Constructor Description
public PackageParser() public PackageParser()

Tika PackageParser Methods

Method Description
public Set<MediaType> getSupportedTypes(ParseContext context) It returns the set of media types supported by this parser.
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException It parses a document stream into a sequence of XHTML SAX events.
protected static Metadata handleEntryMetadata(String name, Date createAt, Date modifiedAt, Long size, XHTMLContentHandler xhtml) throws SAXException, IOException, TikaException

Tika PackageParser Example

Output:

Document Content: META-INF/MANIFEST.MF Manifest-Version: 1.0 Created-By: 1.7.0_01 (Oracle Corporation) Main-Class: First      First.class public synchronized class First {     void First();     public static void main(String[]); } Document Metadata: Content-Type:   application/zip 

You may also like