• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about decompress?  RSS feed

 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
we can decompress file with postfix .zip(use tool of winzip compressed) use jdk's ZipFile class,but How I can decompress file with postfix .rar(use tool of winrar compressed)?
I have renamed it with postfix .zip,but I got error.maybe it use different compress algorism than winzip.Are there any way that I can decompress .rar file?
thanx.
 
Maverick Lasa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i never heard of an existing API for rar de/compression in java. i'm not sure either if the algorithm is available to public
here's a feasible workaround:
- get the native library e.g. UNRAR.DLL
- use JNI to call native methods
mavedrive;
 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx,Maverick,but would you please give a example using jni to call native method?
best regards
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See Sun's JNI Tutorial.
The format is known, though, so another alternative is to write the decoder yourself. See this document from Wotsit's File Formats, a very useful web site!
 
Maverick Lasa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ernest,
Thanks for the link! Great site.
Dragon Ji,
Wotsit has info on the format.
Writing a decoder in pure java
could be better.
mavedrive;
 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx,guys.
I am in trying....
 
Maverick Lasa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dragon ji:
thanx,guys.
I am in trying....

Hello Ji,
Guess what I had found out!
See this page.
It has what you are looking for.
mavedrive;
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!