diff options
| author | Tom Tromey <tromey@cygnus.com> | 2000-11-17 20:44:03 +0000 |
|---|---|---|
| committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-11-17 20:44:03 +0000 |
| commit | 4cdfd292e374089da707399dd3a06ae18f19a094 (patch) | |
| tree | 0ca710082c0fee778050b7a6372e10201f7c22aa /libjava/java/util/zip/InflaterInputStream.java | |
| parent | 6414587c8b13a4a0a45788f411c9fe5fd87466ce (diff) | |
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
Diffstat (limited to 'libjava/java/util/zip/InflaterInputStream.java')
| -rw-r--r-- | libjava/java/util/zip/InflaterInputStream.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java index e09f208349a..3db1b2a1eb3 100644 --- a/libjava/java/util/zip/InflaterInputStream.java +++ b/libjava/java/util/zip/InflaterInputStream.java @@ -1,6 +1,6 @@ // InflaterInputStream.java - Input stream filter for decompressing. -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -28,6 +28,8 @@ public class InflaterInputStream extends FilterInputStream { protected void fill () throws IOException { + if (inf == null) + throw new IOException ("stream closed"); len = in.read(buf, 0, buf.length); if (len != -1) inf.setInput(buf, 0, len); @@ -61,6 +63,8 @@ public class InflaterInputStream extends FilterInputStream public int read (byte[] buf, int off, int len) throws IOException { + if (inf == null) + throw new IOException ("stream closed"); if (inf.finished()) return -1; if (inf.needsInput()) @@ -79,8 +83,26 @@ public class InflaterInputStream extends FilterInputStream } } + public void close () throws IOException + { + inf = null; + super.close (); + } + + public int available () throws IOException + { + // According to the JDK 1.2 docs, this should only ever return 0 + // or 1 and should not be relied upon by Java programs. + if (inf == null) + throw new IOException ("stream closed"); + return inf.finished () ? 0 : 1; + } + public long skip (long n) throws IOException { + if (inf == null) + throw new IOException ("stream closed"); + if (n == 0) return 0; |
