From 4cdfd292e374089da707399dd3a06ae18f19a094 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 17 Nov 2000 20:44:03 +0000 Subject: CollationKey.java: Implement Comparable. * java/text/CollationKey.java: Implement Comparable. (compareTo(Object)): New method. * java/text/Collator.java (compare(Object,Object)): New method. Implement Comparator. * java/util/zip/InflaterInputStream.java (available): New method. (close): New method. (read, available, skip, fill): Throw exception if stream closed. * java/util/zip/ZipInputStream.java (read, skip, readFully, fill, getNextEntry): Throw exception if closed. From-SVN: r37525 --- libjava/java/util/zip/ZipInputStream.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libjava/java/util/zip/ZipInputStream.java') diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java index 79efb59f06c..b50cc7be592 100644 --- a/libjava/java/util/zip/ZipInputStream.java +++ b/libjava/java/util/zip/ZipInputStream.java @@ -35,6 +35,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants public ZipEntry getNextEntry () throws IOException { + if (closed) + throw new IOException ("stream closed"); if (current != null) closeEntry(); if (in.read() != 'P' @@ -112,6 +114,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants // back data. protected void fill () throws IOException { + if (closed) + throw new IOException ("stream closed"); int count = buf.length; if (count > compressed_bytes) count = compressed_bytes; @@ -127,9 +131,11 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants { return new ZipEntry (name); } - + public int read (byte[] b, int off, int len) throws IOException { + if (closed) + throw new IOException ("stream closed"); if (len > avail) len = avail; int count; @@ -149,6 +155,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants public long skip (long n) throws IOException { + if (closed) + throw new IOException ("stream closed"); if (n > avail) n = avail; long count; @@ -160,11 +168,9 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants return count; } - public int available() { - if (closed) - return 0; - else - return 1; + public int available() + { + return closed ? 0 : 1; } private void readFully (byte[] b) throws IOException -- cgit v1.2.3