Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rar algorithm in java?

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still not even sure this effort is useful, but you could try to implement 7zip: http://www.7-zip.org
Brian
 
Ram Mohan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic