ZipEntry, zipinputstream and default constructors.
Posted on 2001-08-08
Wanted to use Java to decompress(unzip) some files (but not all) from a given zip, I started playing with code samples and got an enumeration of a zipfile object to list all the files in a given listbox. --- NO PROBLEM!
Then the idea was double click on the given file which needs decompressing and get that particular file to be decompressed.
Ofcourse I cant use the enumeration object because that could be pointing anywhere (so to speak) so what I treied was something like ...
ZipInputStream zipin = new ZipInputStream(new FileInputStream(name_of_file));
BufferedInputStream bis = new BufferedInputStream(zipin);
FileOutputStream fos = new FileOutputStream(s);
ze = zipin.createZipEntry(specific_entry_in_file);
and err that's where the first problem reared its ugly head - createZipEntry is a protected function to use it I need to create an extended class built on ZipInputStream and create a public function which calls createZipEntry,, problem is I dont know how to handle the constructor which would pass the right InputStream. All my attempts have ended in compiler errors. Default constructors dont seem to be called by super,, but I could be wrong.
So this question comes in 2 parts, how do I handle the constructors etc in an extended class and has anyone experience in java unzip specifc files from an archive.