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 / First Aid / December 2005

Tip: Looking for answers? Try searching our database.

Compressing using java

Thread view: 
ctippur@gmail.com - 02 Dec 2005 10:56 GMT
All,

PS. Please pardon me if I am posting this in the wrong group.

I have used java.util.zip package to compress a folder recursively
(which contains sub folders) using the package java.util.zip. It
created a zip file after that. I am unable to unzip OR gunzip this file
on HPUX.
There are couple of problems on HPUX:
1. there is no unzip tool that comes with the OS distribution
2. gunzip tool that resides in /usr/contrib/bin folder is not
appropriate. When I rename the file to .gz file and run gunzip on it,
it comes with "file exists" error.
I want to achieve the following things:
a) I want to compress a folder recursively.
b) I want to be able to access the files within the compressed file via
java
c) the compressed file must be "uncompressable" via tools available
with OS. THe most convenient tool is compress as it is available
everywhere with regular OS distribution.

I have read on java docs that in order to achieve compress via gzip, we
can do that only to a file. We have to essentially tar the folder and
then gzip the tar ball. If we do it this way, can we access the files
within the tar ball via java?

On Solaris however, I was able to unzip it.
Solaris8 $ unzip XXXX.zip
Archive:  XXXX.zip
 inflating: bin/hpux-risc
 inflating: bin/root.sh
 inflating: bin/createpackage
 inflating: bin/env
 inflating: bin/postinstallcheck
 inflating: bin/agentconnection.sh
Solaris8 $ ls -ltr
total 1168
-rw-r--r--   1 itv1     itv1      585115 Dec  1 16:23 XXXX.zip
drwxr-xr-x   2 itv1     itv1         618 Dec  1 16:23 bin

I appreciate any inputs on this issue.
Thanks
- Shekar
Gordon Beaton - 02 Dec 2005 10:21 GMT
> PS. Please pardon me if I am posting this in the wrong group.

Above all you are posting it in too many groups. Please choose one
group and stay there instead of starting several threads in as many
different groups.

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

ctippur@gmail.com - 02 Dec 2005 12:11 GMT
I am not sure which is the right group for this.

- Shekar
Thomas Weidenfeller - 02 Dec 2005 12:58 GMT
> I am not sure which is the right group for this.

Probably non, because you didn't do your homework:

(a) Decide in which format you want to archive your files. Make double
sure that the format you chose can indeed contain the data you want
(e.g. you apparently want multiple files in one archive). Randomly
picking a format because you just saw a library for it is not a good idea.

(b) Check if you have the necessary tools in Java to build the archive
you want. If not, get them. E.g. Google for libraries implementing the
format, or get the format's documentation and implement it (which
requires some effort).

(c) Check if you have the necessary tools on HP-UX to unpack the
archive. If not, check if you can install them (maybe they are optional
OS installation packages). If that doesn't work, check if there are free
implementations (hint, hint), get them, compile them and install them.
If that doesn't work, write your own tool.

What does not work is to hope that, just because you found tool or
library X in Java and tool Y on your HP-UX, for some magic spell to make
them fit together. Just because you want them to work together will not
make them work together.

/Thomas

PS: Contrary to what has been claimed elsewhere, gzip is not a standard
Unix tool. It is a GNU tool you can find on many OS', particular the
ones build around GNU software or enhanced with GNU software. And you
can install it on almost any system. But it does not come with each
Unix. Historically it was intended as a replacement for compress,
because of the patent problems around the compression algorithm used by
compress.
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

ctippur@gmail.com - 02 Dec 2005 15:58 GMT
Thank you Thomas.

- Shekar


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



©2008 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.