Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading RAR file

 
Ankur Luthra
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic