does java has any api for tar and gzip?

N

Nagesh

hi,

Does java has any api for compressing files or folders by tar and
gzip?where do i get the library(jar) for this? i seen standard java api
only provides java.util.zip classes only. But it does not have any
classes for tar and gzip. Pls give me any links where i get libraires
downloadable.

thanks,
nagesh
 
T

Thomas Kellerer

Nagesh wrote on 25.02.2006 11:31:
hi,

Does java has any api for compressing files or folders by tar and
gzip?where do i get the library(jar) for this? i seen standard java api
only provides java.util.zip classes only. But it does not have any
classes for tar and gzip. Pls give me any links where i get libraires
downloadable.

The standard libraries do supply gzip support:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/GZIPInputStream.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/GZIPOutputStream.html

at least that's what the docs say: "for reading compressed data in the GZIP format"

The Jakarta project seems to be working on tar support:

http://jakarta.apache.org/commons/sandbox/compress/

As this is obviously taken from the Ant sources, you might want to check them as
well.

A quick search in google revealed this as well:
http://www.trustice.com/java/tar/

Thomas
 
N

NOBODY

Does java has any api for compressing files or folders by tar and
gzip?where do i get the library(jar) for this? i seen standard java
api only provides java.util.zip classes only. But it does not have any
classes for tar and gzip. Pls give me any links where i get libraires
downloadable.


googgled 'jtar' (and you should try do the same sometimes...)
http://www.angelfire.com/on/vkjava/


Java supports GZIP, but the GZIPInputStream cannot read multi-member gzip,
that is, a concatenation of gzips, as per the rfc 1952 (see 2.2)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4691425
http://www.faqs.org/rfcs/rfc1952.html (see 2.2)


Beware that gzipping in java is 3x slower than the linux gzip. I resort to
runtime exec('gzip -c') while passing data to stdin and reading it back
from stdout of the spawn process...! (you can wrap it all in a simple
outputstream implementation for a nice reusability).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top