無駄なオーバーライド&スーパークラスの実装にミス。
パッチ。
Index: src/jp/sourceforge/armadillo/zip/ZipInputStream.java =================================================================== --- src/jp/sourceforge/armadillo/zip/ZipInputStream.java (revision 16) +++ src/jp/sourceforge/armadillo/zip/ZipInputStream.java (working copy) @@ -113,47 +113,6 @@ } /* (overridden) - * @see java.io.FilterInputStream#read() - */ - public int read() throws IOException { - ensureOpen(); - int read = frontStream.read(); - if (read != -1) { - --remaining; - } - return read; - } - - /* (overridden) - * @see java.util.zip.InflaterInputStream#read(byte[], int, int) - */ - public int read(byte[] b, int off, int len) throws IOException { - ensureOpen(); - int readLength = frontStream.read(b, off, len); - if (readLength > 0) { - remaining -= readLength; - } - return readLength; - } - - /* (overridden) - * @see java.io.FilterInputStream#skip(long) - */ - public long skip(long n) throws IOException { - ensureOpen(); - long skipped; - if (frontStream == null) { - skipped = in.skip(n); - } else { - skipped = frontStream.skip(n); - } - if (skipped > 0) { - remaining -= skipped; - } - return skipped; - } - - /* (overridden) * @see java.io.FilterInputStream#close() */ public void close() throws IOException { Index: src/jp/sourceforge/armadillo/io/ArchiveInputStream.java =================================================================== --- src/jp/sourceforge/armadillo/io/ArchiveInputStream.java (revision 16) +++ src/jp/sourceforge/armadillo/io/ArchiveInputStream.java (working copy) @@ -37,7 +37,8 @@ */ public int read() throws IOException { ensureOpen(); - if (remaining <= 0) { + if (frontStream != null && remaining <= 0) { + assert remaining == 0; return -1; } InputStream is = (frontStream == null) ? in : frontStream; @@ -54,7 +55,7 @@ */ public int read(byte[] b, int off, int len) throws IOException { ensureOpen(); - if (remaining < 1) { + if (frontStream != null && remaining <= 0) { assert remaining == 0; return -1; } @@ -71,6 +72,10 @@ */ public long skip(long n) throws IOException { ensureOpen(); + if (frontStream != null && remaining <= 0) { + assert remaining == 0; + return -1; + } long skipped; InputStream is = (frontStream == null) ? in : frontStream; skipped = is.skip(n);
以下のコードを実行すると、
だけ出力されて処理が終了する。