Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

rar algorithm in java?

 
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No, tomorrow we rule the world! With this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic