Javatpoint Logo
Javatpoint Logo

Tika Class File Extraction

To extract .class file, Tika provides ClassParser class. This class is used to extract content and metadata from the .class file. It is located into the org.apache.tika.parser.asm package and contains various constructors and methods that are tabled below.

Tika ClassParser Constructor

Constructor Description
public ClassParser() It is used to create instance of the class.

Tika ClassParser Methods

Methods 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.

Tika ClassParser Example

In this example, we are extracting content and metadata from a .class file. See the example.

We have a class First.class that contains the following code.

Output: (after extracting First.class file)

public synchronized class First {
    void First();
    public static void main(String[]);
}
Document Metadata:
dc:title:   First
resourceName:   First.class
title:   First





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA