Java support of GNU Tar



Hello, I'm having difficulties with writing Java code that unpacks and
repacks tar.gz files. I'm really stuck and would appreciate some
help.

I've got the code running using the http://www.trustice.com/java/tar/
library. It is able to uncompress and unpack the tarred gzip file, do
the work the code is supposted to do and unpack and recompress it
suggessfully. However it fails on certain files.

The problem that it reports is that the file name is too long,
exceeding 100 characters. I did a little research and found that GNU
tar supports longer file names but other implementations don't.

After a little more research I found that there is at least one GNU
tar implementation in Java, made by the Apache Ant team. In fact it's
derived from the package I'm already using, so I was hopeful that I
could just drop in their version. This didn't work and I'm not sure
why.

The error I get occurs when I am trying to repack the files into a
Tar. The relevant part of the stack trace is:

java.io.IOException: request to write '7608' bytes exceeds size in
header of '0' bytes
at org.apache.tools.tar.TarOutputStream.write(TarOutputStream.java:
235)
at utilities.ArchiveFormatter.packGZip(ArchiveFormatter.java:324)

Has anyone ever tried to use the Apache code for their own code or
have any idea why I would get the exception above?

.



Relevant Pages

  • Re: traits question
    ... the link exists in the lib directory when i tar up the package. ... Windows users will be using to unpack tars). ... fails when you try to extract it. ...
    (comp.lang.ruby)
  • Re: OOo problems with rpm
    ... >>which I have but then found the tar was faulty. ... >>found a difference in file size, on server 102mb, after download ... command line/shell script in konqueror, it seemed to unpack without ...
    (alt.os.linux.suse)
  • Re: Combination uf tar and gunzip on Solaris
    ... > This will unzip the file, but it won't unpack. ... GNU zcat and/or GNU tar ...
    (comp.unix.solaris)
  • Re: Can I remove directories created by $tar -xvf
    ... directories then you can remove the directory that you built it from (ex. ... directories created by tar -zxvf). ... I usually unpack all tars into the same base directory, ...
    (comp.os.linux)