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 rar algorithm in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "rar algorithm in java?" Watch "rar algorithm in java?" New topic
Author

rar algorithm in java?

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I have a few questions:
1. Is rar based on zip? Could a rar file be opened with java.util.zip.*?
2. Is there an open-source implementation of rar?
3. What would I have to do to make a jar file with rar compression?
For #3, I'm guessing I would need to:
1. Compress the file with rar algorithm
2. Add some special bytes? to signify it's a jar - what are these?
3. add a manifest
4. write my own classloader (extend URLClassloader) that can understand rars.

Am I missing anything? Does anyone know of any work in this area? I think something like this would be great for J2ME, etc because rar almost always compresses quite a bit more than zip.
Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202
Originally posted by Robert Paris:
I have a few questions:
1. Is rar based on zip? Could a rar file be opened with java.util.zip.*?

Pretty sure it's "No" - why not try it for yourself?

2. Is there an open-source implementation of rar?

Doubt it

3. What would I have to do to make a jar file with rar compression?
For #3, I'm guessing I would need to:
1. Compress the file with rar algorithm
2. Add some special bytes? to signify it's a jar - what are these?
3. add a manifest
4. write my own classloader (extend URLClassloader) that can understand rars.

What's the point of doing this anyway?

Am I missing anything? Does anyone know of any work in this area? I think something like this would be great for J2ME, etc because rar almost always compresses quite a bit more than zip.

Ah, that's your point. But so? I mean, one could probably come up with an equally compressed algorithm, but it wouldn't be compatible with JAR either, so what?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
rar is a proprietary technology. Unless the owners of the format release a Java implementation (which is unlikely, I think) there won't be one (unless someone created one based on reverse engineering the algorithm which would be completely unauthorised and possibly a violation of patents).


42
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I did not know that. Is there a non-proprietary format that compresses as well as rar? I'd be totally willing to implement it in java and share it on this site.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I'm still not even sure this effort is useful, but you could try to implement 7zip: http://www.7-zip.org
Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Ram Mohan
Ranch Hand

Joined: Jan 19, 2004
Posts: 44
I guess you're looking for this....http://www.wotsit.org/ where you can search for the "rar" format specification......but as Brian pointed out, i'm sure it's not worth the effort!


If quitters never win, and winners never cheat, who's the idiot that said: Quit while you're ahead?
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
Looks like Tiger was ahead of me on this:
http://java.sun.com/j2se/1.5.0/docs/api/javax/pack/package-summary.html
It's not the RAR algorithm, but it's 8-times more compact than jar/zip.
 
wood burning stoves
 
subject: rar algorithm in java?