You can use ZipInputStream (or JarInputStream) to read the entire contents of jar file. If you put it in some kind of collection, you can always have information about which files are already in there.
The quieter you are, the more you are able to hear.
Joined: Nov 07, 2004
Can I have both input and output stream active on the same file? Basically my program adds files to a jar, but if the file already exist inside then I will skip adding.
No, that's not the right solution. Just keep track of the zip entries as you add them. In some kind of collection, as Kemal said. (A Set would probably be best.) When you go to add another entry, check the collection first to see if the zip entry is already in the archive. If it is, then don't add it again.
(You weren't planning to add new entries to an existing archive, were you? It didn't sound like it from your original post, but I just thought I would ask. Because you can't do that.)