Do you think this code close correctly the output stream entry ? Knowing that this is not the same type of output stream.
OutputStream out = new JarOutputStream(new FileInputstrem(fileName));
...
((ZipOutputStream)out).closeEntry();
But considering that the both are output stream, I thought they were closing in the same way. And therefore in my case ((ZipOutputStream)out).closeEntry(); was the same as ((JarOutputStream)out).closeEntry();
Can you confirm that if you think is true or correct me if is wrong ?
Thanks.
If you need to call methods that are specific to
ZipOutputStreamon youroutvariable, then its type should not beOutputStream, butZipOutputStream:This doesn’t cause any problem, because since
JarOutputStreamextendsZipOutputStream, aJarOutputStreamis also aZipOutputStream(and is also anOutputStream, and is also anObject).