Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

does java has any api for tar and gzip?

Thread view: 
Nagesh - 25 Feb 2006 10:31 GMT
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
Thomas Kellerer - 25 Feb 2006 10:41 GMT
Nagesh wrote on 25.02.2006 11:31:
> hi,
>
[quoted text clipped - 3 lines]
> 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
NOBODY - 25 Feb 2006 12:46 GMT
>   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).
Roedy Green - 25 Feb 2006 23:59 GMT
>But it does not have any
>classes for tar and gzip.

GZIP yes. tar no.  See http://mindprod.com/jgloss/gzip.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Nagesh - 27 Feb 2006 11:17 GMT
The following link was pretty good. Thank you very much Thomas.
http://www.trustice.com/java/tar/

nagesh


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.