aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2000-11-17 21:42:28 +0000
committerMark Wielaard <mark@gcc.gnu.org>2000-11-17 21:42:28 +0000
commit4f21aedbf4c7661626f49e7ca74ecc2a80892262 (patch)
treeb533432fc49fcee89b14b2d5328eddb19a23d95a /libjava
parent4cdfd292e374089da707399dd3a06ae18f19a094 (diff)
downloadgcc-4f21aedbf4c7661626f49e7ca74ecc2a80892262.zip
gcc-4f21aedbf4c7661626f49e7ca74ecc2a80892262.tar.gz
gcc-4f21aedbf4c7661626f49e7ca74ecc2a80892262.tar.bz2
* java/util/zip/*.java: Javadoc and copyright updates.
From-SVN: r37526
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/java/util/zip/Adler32.java104
-rw-r--r--libjava/java/util/zip/CRC32.java69
-rw-r--r--libjava/java/util/zip/CheckedInputStream.java72
-rw-r--r--libjava/java/util/zip/CheckedOutputStream.java58
-rw-r--r--libjava/java/util/zip/Checksum.java64
-rw-r--r--libjava/java/util/zip/DataFormatException.java37
-rw-r--r--libjava/java/util/zip/Deflater.java34
-rw-r--r--libjava/java/util/zip/DeflaterOutputStream.java34
-rw-r--r--libjava/java/util/zip/GZIPInputStream.java34
-rw-r--r--libjava/java/util/zip/GZIPOutputStream.java34
-rw-r--r--libjava/java/util/zip/Inflater.java34
-rw-r--r--libjava/java/util/zip/InflaterInputStream.java34
-rw-r--r--libjava/java/util/zip/ZipConstants.java36
-rw-r--r--libjava/java/util/zip/ZipEntry.java68
-rw-r--r--libjava/java/util/zip/ZipException.java34
-rw-r--r--libjava/java/util/zip/ZipFile.java35
-rw-r--r--libjava/java/util/zip/ZipInputStream.java47
-rw-r--r--libjava/java/util/zip/ZipOutputStream.java33
19 files changed, 670 insertions, 195 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index bf5b81a..2b604bd 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2000-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/*.java: Javadoc updates.
+
2000-11-17 Tom Tromey <tromey@cygnus.com>
* java/text/CollationKey.java: Implement Comparable.
diff --git a/libjava/java/util/zip/Adler32.java b/libjava/java/util/zip/Adler32.java
index e7afeab..989a204 100644
--- a/libjava/java/util/zip/Adler32.java
+++ b/libjava/java/util/zip/Adler32.java
@@ -1,18 +1,31 @@
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* Adler.java - Computes Adler32 data checksum of a data stream
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
-/**
- * @author Per Bothner
- * @date April 6, 1999.
- */
-
/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
@@ -20,31 +33,67 @@ package java.util.zip;
* Status: Believed complete and correct.
*/
+/**
+ * Computes Adler32 data checksum of a data stream.
+ * The actual Adler32 algorithm is described in RFC 1950
+ * (ZLIB Compressed Data Format Specification version 3.3).
+ * Can be used to get the CRC32 over a stream if used with checked input/output
+ * streams.
+ *
+ * @see InflaterInputStream
+ * @see InflaterOutputStream
+ *
+ * @author Per Bothner
+ * @date April 6, 1999.
+ */
public class Adler32 implements Checksum
{
- private static int BASE = 65521; /* largest prime smaller than 65536 */
+ /** largest prime smaller than 65536 */
+ private static int BASE = 65521;
+
private int s1;
private int s2;
+ /**
+ * Creates an Adler32 data checksum.
+ */
public Adler32 ()
{
reset();
}
+ /**
+ * Resets the Adler32 data checksum as if no update was ever called.
+ */
public void reset () { s1 = 1; s2 = 0; }
+ /**
+ * Adds one byte to the data checksum.
+ *
+ * @param bval the data value to add. The high byte of the int is ignored.
+ */
public void update (int bval)
{
s1 = (s1 + (bval & 0xFF)) % BASE;
s2 = (s1 + s2) % BASE;
}
+ /**
+ * Adds the complete byte array to the data checksum.
+ */
public void update (byte[] buffer)
{
update(buffer, 0, buffer.length);
}
+ /**
+ * Adds the byte array to the data checksum.
+ *
+ * @param buf the buffer which contains the data
+ * @param off the offset in the buffer where the data starts
+ * @param len the length of the data
+ */
public void update (byte[] buf, int off, int len)
{
int s1 = this.s1;
@@ -68,34 +117,11 @@ public class Adler32 implements Checksum
this.s2 = s2;
}
+ /**
+ * Returns the Adler32 data checksum computed so far.
+ */
public long getValue()
{
return ((long) s2 << 16) + s1;
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libjava/java/util/zip/CRC32.java b/libjava/java/util/zip/CRC32.java
index 1abbcad..c6d9ed4 100644
--- a/libjava/java/util/zip/CRC32.java
+++ b/libjava/java/util/zip/CRC32.java
@@ -1,17 +1,30 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* CRC32.java - Computes CRC32 data checksum of a data stream
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-package java.util.zip;
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-/**
- * @author Per Bothner
- * @date April 1, 1999.
- */
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+package java.util.zip;
/*
* Written using on-line Java Platform 1.2 API Specification, as well
@@ -20,14 +33,29 @@ package java.util.zip;
* Status: Believed complete and correct.
*/
+/**
+ * Computes CRC32 data checksum of a data stream.
+ * The actual CRC32 algorithm is described in RFC 1952
+ * (GZIP file format specification version 4.3).
+ * Can be used to get the CRC32 over a stream if used with checked input/output
+ * streams.
+ *
+ * @see InflaterInputStream
+ * @see InflaterOutputStream
+ *
+ * @author Per Bothner
+ * @date April 1, 1999.
+ */
public class CRC32 implements Checksum
{
+ /** The crc data checksum so far. */
private int crc = 0;
+ /** The fast CRC table. Computed once when the CRC32 class is loaded. */
private static int[] crc_table = make_crc_table();
- /* Make the table for a fast CRC. */
- static int[] make_crc_table ()
+ /** Make the table for a fast CRC. */
+ private static int[] make_crc_table ()
{
int[] crc_table = new int[256];
for (int n = 0; n < 256; n++)
@@ -45,11 +73,17 @@ public class CRC32 implements Checksum
return crc_table;
}
+ /**
+ * Returns the CRC32 data checksum computed so far.
+ */
public long getValue ()
{
return (long) crc & 0xffffffffL;
}
+ /**
+ * Resets the CRC32 data checksum as if no update was ever called.
+ */
public void reset () { crc = 0; }
public void update (int bval)
@@ -59,6 +93,13 @@ public class CRC32 implements Checksum
crc = ~c;
}
+ /**
+ * Adds the byte array to the data checksum.
+ *
+ * @param buf the buffer which contains the data
+ * @param off the offset in the buffer where the data starts
+ * @param len the length of the data
+ */
public void update (byte[] buf, int off, int len)
{
int c = ~crc;
@@ -66,5 +107,9 @@ public class CRC32 implements Checksum
c = crc_table[(c ^ buf[off++]) & 0xff] ^ (c >>> 8);
crc = ~c;
}
+
+ /**
+ * Adds the complete byte array to the data checksum.
+ */
public void update (byte[] buf) { update(buf, 0, buf.length); }
}
diff --git a/libjava/java/util/zip/CheckedInputStream.java b/libjava/java/util/zip/CheckedInputStream.java
index 0901743..80a7bb6 100644
--- a/libjava/java/util/zip/CheckedInputStream.java
+++ b/libjava/java/util/zip/CheckedInputStream.java
@@ -1,12 +1,28 @@
-// CheckedInputStream.java - Compute checksum of data being read.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* CheckedInputStream.java - Compute checksum of data being read
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
@@ -14,29 +30,45 @@ import java.io.FilterInputStream;
import java.io.InputStream;
import java.io.IOException;
-/**
- * @author Tom Tromey
- * @date May 17, 1999
- */
-
/* Written using on-line Java Platform 1.2 API Specification
* and JCL book.
* Believed complete and correct.
*/
+/**
+ * InputStream that computes a checksum of the data being read using a
+ * supplied Checksum object.
+ *
+ * @see Checksum
+ *
+ * @author Tom Tromey
+ * @date May 17, 1999
+ */
public class CheckedInputStream extends FilterInputStream
{
+ /**
+ * Creates a new CheckInputStream on top of the supplied OutputStream
+ * using the supplied Checksum.
+ */
public CheckedInputStream (InputStream in, Checksum sum)
{
super (in);
this.sum = sum;
}
+ /**
+ * Returns the Checksum object used. To get the data checksum computed so
+ * far call <code>getChecksum.getValue()</code>.
+ */
public Checksum getChecksum ()
{
return sum;
}
+ /**
+ * Reads one byte, updates the checksum and returns the read byte
+ * (or -1 when the end of file was reached).
+ */
public int read () throws IOException
{
int x = in.read();
@@ -45,6 +77,11 @@ public class CheckedInputStream extends FilterInputStream
return x;
}
+ /**
+ * Reads at most len bytes in the supplied buffer and updates the checksum
+ * with it. Returns the number of bytes actually read or -1 when the end
+ * of file was reached.
+ */
public int read (byte[] buf, int off, int len) throws IOException
{
int r = in.read(buf, off, len);
@@ -53,6 +90,11 @@ public class CheckedInputStream extends FilterInputStream
return r;
}
+ /**
+ * Skips n bytes by reading them in a temporary buffer and updating the
+ * the checksum with that buffer. Returns the actual number of bytes skiped
+ * which can be less then requested when the end of file is reached.
+ */
public long skip (long n) throws IOException
{
if (n == 0)
@@ -76,6 +118,6 @@ public class CheckedInputStream extends FilterInputStream
return s;
}
- // The checksum object.
+ /** The checksum object. */
private Checksum sum;
}
diff --git a/libjava/java/util/zip/CheckedOutputStream.java b/libjava/java/util/zip/CheckedOutputStream.java
index a632303..276f498 100644
--- a/libjava/java/util/zip/CheckedOutputStream.java
+++ b/libjava/java/util/zip/CheckedOutputStream.java
@@ -1,12 +1,28 @@
-// CheckedOutputStream.java - Compute checksum of data being written.
+/* CheckedOutputStream.java - Compute checksum of data being written.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-/* Copyright (C) 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
@@ -14,41 +30,59 @@ import java.io.FilterOutputStream;
import java.io.OutputStream;
import java.io.IOException;
-/**
- * @author Tom Tromey
- * @date May 17, 1999
- */
-
/* Written using on-line Java Platform 1.2 API Specification
* and JCL book.
* Believed complete and correct.
*/
+/**
+ * OutputStream that computes a checksum of data being written using a
+ * supplied Checksum object.
+ *
+ * @see Checksum
+ *
+ * @author Tom Tromey
+ * @date May 17, 1999
+ */
public class CheckedOutputStream extends FilterOutputStream
{
+ /**
+ * Creates a new CheckInputStream on top of the supplied OutputStream
+ * using the supplied Checksum.
+ */
public CheckedOutputStream (OutputStream out, Checksum cksum)
{
super (out);
this.sum = cksum;
}
+ /**
+ * Returns the Checksum object used. To get the data checksum computed so
+ * far call <code>getChecksum.getValue()</code>.
+ */
public Checksum getChecksum ()
{
return sum;
}
+ /**
+ * Writes one byte to the OutputStream and updates the Checksum.
+ */
public void write (int bval) throws IOException
{
out.write(bval);
sum.update(bval);
}
+ /**
+ * Writes the byte array to the OutputStream and updates the Checksum.
+ */
public void write (byte[] buf, int off, int len) throws IOException
{
out.write(buf, off, len);
sum.update(buf, off, len);
}
- // The checksum object.
+ /** The checksum object. */
private Checksum sum;
}
diff --git a/libjava/java/util/zip/Checksum.java b/libjava/java/util/zip/Checksum.java
index e37d183..f9f214e 100644
--- a/libjava/java/util/zip/Checksum.java
+++ b/libjava/java/util/zip/Checksum.java
@@ -1,17 +1,30 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Checksum.java - Interface to compute a data checksum
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-package java.util.zip;
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-/**
- * @author Per Bothner
- * @date January 9, 1999.
- */
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+package java.util.zip;
/*
* Written using on-line Java Platform 1.2 API Specification, as well
@@ -19,13 +32,44 @@ package java.util.zip;
* Status: Believed complete and correct.
*/
+/**
+ * Interface to compute a data checksum used by checked input/output streams.
+ * A data checksum can be updated by one byte or with a byte array. After each
+ * update the value of the current checksum can be returned by calling
+ * <code>getValue</code>. The complete checksum object can also be reset
+ * so it can be used again with new data.
+ *
+ * @see CheckedInputStream
+ * @see CheckedOutputStream
+ *
+ * @author Per Bothner
+ * @date January 9, 1999.
+ */
public interface Checksum
{
+ /**
+ * Returns the data checksum computed so far.
+ */
public long getValue ();
+ /**
+ * Resets the data checksum as if no update was ever called.
+ */
public void reset ();
+ /**
+ * Adds one byte to the data checksum.
+ *
+ * @param bval the data value to add. The high byte of the int is ignored.
+ */
public void update (int bval);
+ /**
+ * Adds the byte array to the data checksum.
+ *
+ * @param buf the buffer which contains the data
+ * @param off the offset in the buffer where the data starts
+ * @param len the length of the data
+ */
public void update (byte[] buf, int off, int len);
}
diff --git a/libjava/java/util/zip/DataFormatException.java b/libjava/java/util/zip/DataFormatException.java
index 10d1616..eae4a2a 100644
--- a/libjava/java/util/zip/DataFormatException.java
+++ b/libjava/java/util/zip/DataFormatException.java
@@ -1,12 +1,28 @@
-// DataFormatException.java
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libjava.
-
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
+/* DataformatException.java - Exception thrown when compressed data is corrupt
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
@@ -19,6 +35,9 @@ package java.util.zip;
* Believed complete and correct.
*/
+/**
+ * Exception thrown when compressed data is corrupt.
+ */
public class DataFormatException extends Exception
{
public DataFormatException ()
diff --git a/libjava/java/util/zip/Deflater.java b/libjava/java/util/zip/Deflater.java
index 6cf82a7..6320832 100644
--- a/libjava/java/util/zip/Deflater.java
+++ b/libjava/java/util/zip/Deflater.java
@@ -1,12 +1,28 @@
-// Deflater.java - Compress a data stream.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* Deflater.java - Compress a data stream
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java
index 410d886..d4218fa 100644
--- a/libjava/java/util/zip/DeflaterOutputStream.java
+++ b/libjava/java/util/zip/DeflaterOutputStream.java
@@ -1,12 +1,28 @@
-// DeflaterOutputStream.java - Output filter for compressing.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* DeflaterOutputStream.java - Output filter for compressing.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/GZIPInputStream.java b/libjava/java/util/zip/GZIPInputStream.java
index bea5eb3..4279e90 100644
--- a/libjava/java/util/zip/GZIPInputStream.java
+++ b/libjava/java/util/zip/GZIPInputStream.java
@@ -1,12 +1,28 @@
-// GZIPInputStream.java - Input tiler for reading gzip file.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* GZIPInputStream.java - Input filter for reading gzip file
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/GZIPOutputStream.java b/libjava/java/util/zip/GZIPOutputStream.java
index be11727..cf62fb7 100644
--- a/libjava/java/util/zip/GZIPOutputStream.java
+++ b/libjava/java/util/zip/GZIPOutputStream.java
@@ -1,12 +1,28 @@
-// GZIPOutputStream.java - Create a file in gzip format.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* GZIPOutputStream.java - Create a file in gzip format
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/Inflater.java b/libjava/java/util/zip/Inflater.java
index dc2e24d..eb3512a 100644
--- a/libjava/java/util/zip/Inflater.java
+++ b/libjava/java/util/zip/Inflater.java
@@ -1,12 +1,28 @@
-// Inflater.java - Decompress a data stream.
-
-/* Copyright (C) 1999 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* Inflater.java - Decompress a data stream
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java
index 3db1b2a..005c821 100644
--- a/libjava/java/util/zip/InflaterInputStream.java
+++ b/libjava/java/util/zip/InflaterInputStream.java
@@ -1,12 +1,28 @@
-// InflaterInputStream.java - Input stream filter for decompressing.
-
-/* Copyright (C) 1999, 2000 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* InflaterInputStream.java - Input stream filter for decompressing
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/ZipConstants.java b/libjava/java/util/zip/ZipConstants.java
index 3e3cd8a..1313d48 100644
--- a/libjava/java/util/zip/ZipConstants.java
+++ b/libjava/java/util/zip/ZipConstants.java
@@ -1,13 +1,39 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* ZipConstants.java - Some constants used in the zip package
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
+/**
+ * Some constants used in the zip package.
+ * <p>
+ * Since this package local interface is completely undocumented no effort
+ * is made to make it compatible with other implementations.
+ * If someone is really interested you can probably come up with the right
+ * constants and documentation by studying the Info-ZIP zipfile.c constants.
+ */
interface ZipConstants
{
// Size in bytes of local file header, including signature.
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java
index 99cb3aa..c3a8023 100644
--- a/libjava/java/util/zip/ZipEntry.java
+++ b/libjava/java/util/zip/ZipEntry.java
@@ -1,10 +1,28 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* ZipEntry.java - Represents entries in a zip file archive
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
@@ -19,6 +37,12 @@ package java.util.zip;
* Status: Believed complete and correct.
*/
+/**
+ * Represents entries in a zip file archive.
+ * An Entry cn be created by giving a name or by giving an already existing
+ * ZipEntries whose values should be copied. The name normally represents a
+ * file path name or directory name.
+ */
public class ZipEntry implements ZipConstants, Cloneable
{
// These values were determined using a simple test program.
@@ -44,6 +68,16 @@ public class ZipEntry implements ZipConstants, Cloneable
this.name = name;
}
+ /**
+ * Creates a new ZipEntry using the fields of a given ZipEntry.
+ * The comment, compressedSize, crc, extra, method, name, size, time and
+ * relativeOffset fields are copied from the given entry.
+ * Note that the contents of the extra byte array field is not cloned,
+ * only the reference is copied.
+ * The clone() method does clone the contents of the extra byte array if
+ * needed.
+ * @since 1.2
+ */
public ZipEntry (ZipEntry ent)
{
comment = ent.comment;
@@ -56,7 +90,13 @@ public class ZipEntry implements ZipConstants, Cloneable
time = ent.time;
relativeOffset = ent.relativeOffset;
}
-
+
+ /**
+ * Creates a clone of this ZipEntry. Calls <code>new ZipEntry (this)</code>
+ * and creates a clone of the contents of the extra byte array field.
+ *
+ * @since 1.2
+ */
public Object clone ()
{
// JCL defines this as being the same as the copy constructor above,
@@ -99,7 +139,12 @@ public class ZipEntry implements ZipConstants, Cloneable
throw new IllegalArgumentException ();
this.comment = comment;
}
-
+
+ /**
+ * Sets the compressedSize of this ZipEntry.
+ * The new size must be between 0 and 0xffffffffL.
+ * @since 1.2
+ */
public void setCompressedSize (long compressedSize)
{
if (compressedSize < 0 || compressedSize > 0xffffffffL)
@@ -172,6 +217,9 @@ public class ZipEntry implements ZipConstants, Cloneable
}
public String toString () { return name; }
-
+
+ /**
+ * Returns the hashcode of the name of this ZipEntry.
+ */
public int hashCode () { return name.hashCode (); }
}
diff --git a/libjava/java/util/zip/ZipException.java b/libjava/java/util/zip/ZipException.java
index a4a119c..b9b63c7 100644
--- a/libjava/java/util/zip/ZipException.java
+++ b/libjava/java/util/zip/ZipException.java
@@ -1,12 +1,28 @@
-// ZipException.java
-
-/* Copyright (C) 1998, 1999 Free Software Foundation
-
- This file is part of libjava.
-
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
+/* ZipException.java - Exception representing a zip related error
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index 58e2748..d0dbb92 100644
--- a/libjava/java/util/zip/ZipFile.java
+++ b/libjava/java/util/zip/ZipFile.java
@@ -1,14 +1,31 @@
-// ZipFile.java - Read contents of a ZIP file.
+/* ZipFile.java - Read contents of a ZIP file
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
+
import java.io.*;
/* Written using on-line Java Platform 1.2 API Specification
@@ -166,6 +183,12 @@ public class ZipFile implements ZipConstants
return name;
}
+ /**
+ * Returns the number of entries in this ZipFile.
+ * @exception IllegalStateException if the ZipFile has been closed.
+ *
+ * @since 1.2
+ */
public int size ()
{
if (entries == null)
diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java
index b50cc7b..1836859 100644
--- a/libjava/java/util/zip/ZipInputStream.java
+++ b/libjava/java/util/zip/ZipInputStream.java
@@ -1,10 +1,28 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* ZipInputStream.java - Input filter for reading zip file
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
import java.io.*;
@@ -20,8 +38,6 @@ import java.io.*;
* Status: Quite incomplete, but can read uncompressed .zip archives.
*/
-// JDK1.2 has "protected ZipEntry createZipEntry(String)" but is very
-// vague about what the method does. FIXME.
// We do not calculate the CRC and compare it with the specified value;
// we probably should. FIXME.
@@ -127,6 +143,13 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
}
}
+ /**
+ * Creates a new ZipEntry with the given name.
+ * Used by ZipInputStream when normally <code>new ZipEntry (name)</code>
+ * would be called. This gives subclasses such as JarInputStream a change
+ * to override this method and add aditional information to the ZipEntry
+ * (subclass).
+ */
protected ZipEntry createZipEntry (String name)
{
return new ZipEntry (name);
@@ -168,6 +191,11 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
return count;
}
+ /**
+ * Returns 0 if the ZipInputStream is closed and 1 otherwise.
+ *
+ * @since 1.2
+ */
public int available()
{
return closed ? 0 : 1;
@@ -232,6 +260,11 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
}
}
+ /**
+ * Closes this InflaterInputStream.
+ *
+ * @since 1.2
+ */
public void close () throws IOException
{
current = null;
diff --git a/libjava/java/util/zip/ZipOutputStream.java b/libjava/java/util/zip/ZipOutputStream.java
index afd5664..a0a8ed7 100644
--- a/libjava/java/util/zip/ZipOutputStream.java
+++ b/libjava/java/util/zip/ZipOutputStream.java
@@ -1,12 +1,31 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* ZipOutputStream.java - Create a file in zip format
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.util.zip;
+
import java.io.*;
/* Written using on-line Java Platform 1.2 API Specification