Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Your thoughts on Java API and Archives (zip,jar etc..)

Thread Tools

Your thoughts on Java API and Archives (zip,jar etc..)
Posts: n/a
So, I have been working extensively with jar files of late and now we
need to migrate to tar files, and the nagging problem continues to be


I mean, the use of a jar and a manifest using the API's is really
whacked -- you can't create a Manifest and add entries to it, you have
to create a properly formatted UTF-8 byte sequence. But of course, you
can READ manifest entries all day.

Now we have the issue of the Streams and files. The streams have a
handfull of methods in common, but do things like:

ZipEntry getNextEntry()

JarEntry getNextJarEntry()

Now, the implementation I have found for tar (which the API's do not
have) is that they too have similar method names (close(),
putNextEntry()) etc, but because there isn't a common interface for
archives, I cannot seemlessly process the above mentioned types.

What I have done, to facilitate thise generic behavior is to implement
a combination of adapter interfaces and delegation -- and then I only
have to switch my current code to the new interface.

basically, I have done is

public interface ArchiveInputStream {

public ArchiveEntry nextEntry() throws IOException;

public int read(byte[] outBucket,int start, int amount) throws

public void close() throws IOException;

public class MyJarInputStream extends JarInputStream implements
ArchiveInputStream {
private static final Log logger =

public MyJarInputStream (InputStream in) throws IOException {

public ArchiveEntry nextEntry() throws IOException {
return new JarArchiveEntry(getNextJarEntry());


I have done the same trick with the entry types for the archives and

This seems to me to be exceptionally poor design in the Java libraries
-- a rarity.
Thoughts? Am I just spiking my java with peyote or what?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to properly recursively navigate into archives stored in archives David Karr Perl Misc 2 06-01-2012 05:54 PM
creating identical zip archives with java and zip tools m.niinimaki Java 9 08-29-2010 10:13 AM
"Change your language and you change your thoughts." Suganya C Programming 0 04-29-2008 01:35 PM
Python 3000: Standard API for archives? samwyse Python 3 06-05-2007 06:48 PM
RMI and Java-Archives! nullstring Java 1 11-15-2006 04:12 PM