7766 – ZipInputStream.available returns 0 immediately after construction (original) (raw)
Immediately after construction of a ZipInputStream, available()
will return 0. Sun's javadoc states, "Returns 0 after EOF has
reached for the current entry data, otherwise always return 1."
My interpretation is there is no current entry, so EOF hasn't
been reached on it yet, so return 1.Release: 3.3 20020828 (experimental)
Environment: System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown Architecture: i686
host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/home/user/jmr/app/gcc --enable-langs=c++,java --enable-shared --enable-threads=posix --with-as=/home/user/jmr/app/binutils/bin/as --with-ld=/home/user/jmr/app/binutils/bin/ld : (reconfigured)
How-To-Repeat: ; cat ZISAvailTest.java import java.net.URL; import java.util.zip.ZipInputStream;
public class ZISAvailTest { public static void main(String[] s) throws Exception { URL u = new URL("http://www.xwt.org/dist/xwt-0258.jar"); System.err.println(new ZipInputStream(u.openStream()).available()); } }
; gcj ZISAvailTest.java --main=ZISAvailTest
; ./a.out
0
Whereas Sun's jdk gives: ; javac ZISAvailTest.java ; java ZISAvailTest 1