Skip to content
Advertisement

Read Content from Files which are inside Zip file

I am trying to create a simple java program which reads and extracts the content from the file(s) inside zip file. Zip file contains 3 files (txt, pdf, docx). I need to read the contents of all these files and I am using Apache Tika for this purpose.

Can somebody help me out here to achieve the functionality. I have tried this so far but no success

Code Snippet

JavaScript

Advertisement

Answer

If you’re wondering how to get the file content from each ZipEntry it’s actually quite simple. Here’s a sample code:

JavaScript

Once you have the InputStream you can read it however you want.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement