PR 8234: ZipInputStream chokes when InputStream.read() returns small chunks
Adam Megacz
gcj@lists.megacz.com
Tue Oct 15 13:10:00 GMT 2002
Conclusive proof that java.util.zip is broken.
import java.io.*;
import java.net.*;
import java.util.zip.*;
public class test {
public static void main(String[] s) throws Exception {
InputStream is = new URL(" http://www.megacz.com/gcj-bug.zip").openStream();
ZipInputStream zis = new ZipInputStream(new FilterInputStream(is) {
public int read(byte[] b, int off, int len) throws IOException {
int ret = 0;
if (len > 32) len = 32;
while (len > 0) {
int read = super.read(b, off, len);
if (read == -1) break;
ret += read;
len -= read;
off += read;
}
return ret;
}
});
while(zis.getNextEntry() != null) { }
}
}
- a
--
"Through your rags I see your vanity" -- Socrates
More information about the Java
mailing list