From 4f21aedbf4c7661626f49e7ca74ecc2a80892262 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 17 Nov 2000 21:42:28 +0000 Subject: [PATCH] * java/util/zip/*.java: Javadoc and copyright updates. From-SVN: r37526 --- libjava/ChangeLog | 4 + libjava/java/util/zip/Adler32.java | 100 +++++++++++------- libjava/java/util/zip/CRC32.java | 69 +++++++++--- libjava/java/util/zip/CheckedInputStream.java | 66 +++++++++--- .../java/util/zip/CheckedOutputStream.java | 58 +++++++--- libjava/java/util/zip/Checksum.java | 64 +++++++++-- .../java/util/zip/DataFormatException.java | 31 ++++-- libjava/java/util/zip/Deflater.java | 28 +++-- .../java/util/zip/DeflaterOutputStream.java | 28 +++-- libjava/java/util/zip/GZIPInputStream.java | 28 +++-- libjava/java/util/zip/GZIPOutputStream.java | 28 +++-- libjava/java/util/zip/Inflater.java | 28 +++-- .../java/util/zip/InflaterInputStream.java | 28 +++-- libjava/java/util/zip/ZipConstants.java | 36 ++++++- libjava/java/util/zip/ZipEntry.java | 64 +++++++++-- libjava/java/util/zip/ZipException.java | 28 +++-- libjava/java/util/zip/ZipFile.java | 35 ++++-- libjava/java/util/zip/ZipInputStream.java | 47 ++++++-- libjava/java/util/zip/ZipOutputStream.java | 29 ++++- 19 files changed, 637 insertions(+), 162 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index bf5b81a7d0b..2b604bd7963 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2000-11-17 Mark Wielaard + + * java/util/zip/*.java: Javadoc updates. + 2000-11-17 Tom Tromey * java/text/CollationKey.java: Implement Comparable. diff --git a/libjava/java/util/zip/Adler32.java b/libjava/java/util/zip/Adler32.java index e7afeabde16..989a2049283 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 +/* Adler.java - Computes Adler32 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. + +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 1abbcad1d97..c6d9ed4ede2 100644 --- a/libjava/java/util/zip/CRC32.java +++ b/libjava/java/util/zip/CRC32.java @@ -1,18 +1,31 @@ -/* 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. + +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 1, 1999. - */ - /* * Written using on-line Java Platform 1.2 API Specification, as well * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). @@ -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 0901743e6a7..80a7bb660d0 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. +/* CheckedInputStream.java - Compute checksum of data being read + 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,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 getChecksum.getValue(). + */ 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 a6323037cd7..276f4980962 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 getChecksum.getValue(). + */ 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 e37d1834e04..f9f214e4f2a 100644 --- a/libjava/java/util/zip/Checksum.java +++ b/libjava/java/util/zip/Checksum.java @@ -1,31 +1,75 @@ -/* 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. + +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 January 9, 1999. - */ - /* * Written using on-line Java Platform 1.2 API Specification, as well * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). * 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 + * getValue. 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 10d1616cdd6..eae4a2a89ed 100644 --- a/libjava/java/util/zip/DataFormatException.java +++ b/libjava/java/util/zip/DataFormatException.java @@ -1,12 +1,28 @@ -// DataFormatException.java +/* DataformatException.java - Exception thrown when compressed data is corrupt + 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 libjava. +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 -Libjava License. Please consult the file "LIBJAVA_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; @@ -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 6cf82a79550..63208324a20 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. +/* Deflater.java - Compress a data stream + 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; diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java index 410d8868106..d4218fa5cc5 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. +/* DeflaterOutputStream.java - Output filter for compressing. + 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; diff --git a/libjava/java/util/zip/GZIPInputStream.java b/libjava/java/util/zip/GZIPInputStream.java index bea5eb38b1d..4279e90c5b1 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. +/* GZIPInputStream.java - Input filter for reading gzip file + 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; diff --git a/libjava/java/util/zip/GZIPOutputStream.java b/libjava/java/util/zip/GZIPOutputStream.java index be117273cde..cf62fb7c6bf 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. +/* GZIPOutputStream.java - Create a file in gzip format + 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; diff --git a/libjava/java/util/zip/Inflater.java b/libjava/java/util/zip/Inflater.java index dc2e24dec1e..eb3512ae583 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. +/* Inflater.java - Decompress a data stream + 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; diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java index 3db1b2a1eb3..005c82179d1 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. +/* InflaterInputStream.java - Input stream filter for decompressing + 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; diff --git a/libjava/java/util/zip/ZipConstants.java b/libjava/java/util/zip/ZipConstants.java index 3e3cd8a1c37..1313d48aa69 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. + *

+ * 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 99cb3aacb22..c3a8023c55b 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 +/* ZipEntry.java - Represents entries in a zip file archive + 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; @@ -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 new ZipEntry (this) + * 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 a4a119c7480..b9b63c7b194 100644 --- a/libjava/java/util/zip/ZipException.java +++ b/libjava/java/util/zip/ZipException.java @@ -1,12 +1,28 @@ -// ZipException.java +/* ZipException.java - Exception representing a zip related error + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. -/* Copyright (C) 1998, 1999 Free Software Foundation +This file is part of GNU Classpath. - This file is part of libjava. +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 -Libjava License. Please consult the file "LIBJAVA_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; diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java index 58e2748fd12..d0dbb9276dc 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 b50cc7be592..1836859f052 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 new ZipEntry (name) + * 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 afd5664ca28..a0a8ed744bb 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 +/* ZipOutputStream.java - Create a file in zip format + 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.*; /* Written using on-line Java Platform 1.2 API Specification