* java/util/zip/*.java: Javadoc and copyright updates.

From-SVN: r37526
This commit is contained in:
Mark Wielaard 2000-11-17 21:42:28 +00:00 committed by Mark Wielaard
parent 4cdfd292e3
commit 4f21aedbf4
19 changed files with 637 additions and 162 deletions

View File

@ -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.

View File

@ -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;
}
}

View File

@ -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); }
}

View File

@ -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 <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;
}

View File

@ -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;
}

View File

@ -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
* <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);
}

View File

@ -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 ()

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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 <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 (); }
}

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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