File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Reading RAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Reading RAR file" Watch "Reading RAR file" New topic
Author

Reading RAR file

Ankur Luthra
Ranch Hand

Joined: Dec 13, 2010
Posts: 36
Hi,
I am trying to find checksum of all class files in a archive (zip /rar)
I have a method which takes Input Stream as input and returns checksum for the class.
I am able to read the zip archive using ZipInputStream ,ZipEntry and ZipFile classes but somehow not able to read rar files.
I came across few 3rd party jars which claim to read Rar file(RaroScope.I guess that was the name).
Just wanted to know if I can do it in Java.
I am using below code .The second line returns null in case of rar file but it returns an entry in case of zip file


Kindly provide me with some suggestions.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
RAR is not ZIP, so it's no wonder that this doesn't work. The standard Java compression library (Apache Commons Compress) doesn't handle it, either, so you'll have to use a 3rd party implementation like https://github.com/edmund-wagner/junrar
Ankur Luthra
Ranch Hand

Joined: Dec 13, 2010
Posts: 36
Ulf Dittmer wrote:RAR is not ZIP, so it's no wonder that this doesn't work. The standard Java compression library (Apache Commons Compress) doesn't handle it, either, so you'll have to use a 3rd party implementation like https://github.com/edmund-wagner/junrar


Thanks Dittmer for your advice :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading RAR file