Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,205 @@
/* Adler32.java - Computes Adler32 data checksum of a data stream
Copyright (C) 1999, 2000, 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* The actual Adler32 algorithm is taken from RFC 1950.
* Status: Believed complete and correct.
*/
/**
* Computes Adler32 checksum for a stream of data. An Adler32
* checksum is not as reliable as a CRC32 checksum, but a lot faster to
* compute.
*<p>
* The specification for Adler32 may be found in RFC 1950.
* (ZLIB Compressed Data Format Specification version 3.3)
*<p>
*<p>
* From that document:
*<p>
* "ADLER32 (Adler-32 checksum)
* This contains a checksum value of the uncompressed data
* (excluding any dictionary data) computed according to Adler-32
* algorithm. This algorithm is a 32-bit extension and improvement
* of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073
* standard.
*<p>
* Adler-32 is composed of two sums accumulated per byte: s1 is
* the sum of all bytes, s2 is the sum of all s1 values. Both sums
* are done modulo 65521. s1 is initialized to 1, s2 to zero. The
* Adler-32 checksum is stored as s2*65536 + s1 in most-
* significant-byte first (network) order."
*<p>
* "8.2. The Adler-32 algorithm
*<p>
* The Adler-32 algorithm is much faster than the CRC32 algorithm yet
* still provides an extremely low probability of undetected errors.
*<p>
* The modulo on unsigned long accumulators can be delayed for 5552
* bytes, so the modulo operation time is negligible. If the bytes
* are a, b, c, the second sum is 3a + 2b + c + 3, and so is position
* and order sensitive, unlike the first sum, which is just a
* checksum. That 65521 is prime is important to avoid a possible
* large class of two-byte errors that leave the check unchanged.
* (The Fletcher checksum uses 255, which is not prime and which also
* makes the Fletcher check insensitive to single byte changes 0 <->
* 255.)
*<p>
* The sum s1 is initialized to 1 instead of zero to make the length
* of the sequence part of s2, so that the length does not have to be
* checked separately. (Any sequence of zeroes has a Fletcher
* checksum of zero.)"
*
* @author John Leuner, Per Bothner
* @since JDK 1.1
*
* @see InflaterInputStream
* @see DeflaterOutputStream
*/
public class Adler32 implements Checksum
{
/** largest prime smaller than 65536 */
private static final int BASE = 65521;
private int adler; //we do all in int.
//Note that java doesn't have unsigned integers,
//so we have to be careful with what arithmetic
//we do. We return the checksum as a long to
//avoid sign confusion.
/**
* Creates a new instance of the <code>Adler32</code> class.
* The checksum starts off with a value of 1.
*/
public Adler32 ()
{
reset();
}
/**
* Resets the Adler32 checksum to the initial value.
*/
public void reset ()
{
adler = 1; //Initialize to 1
}
/**
* Updates the checksum with the byte b.
*
* @param bval the data value to add. The high byte of the int is ignored.
*/
public void update (int bval)
{
//We could make a length 1 byte array and call update again, but I
//would rather not have that overhead
int s1 = adler & 0xffff;
int s2 = adler >>> 16;
s1 = (s1 + (bval & 0xFF)) % BASE;
s2 = (s1 + s2) % BASE;
adler = (s2 << 16) + s1;
}
/**
* Updates the checksum with the bytes taken from the array.
*
* @param buffer an array of bytes
*/
public void update (byte[] buffer)
{
update(buffer, 0, buffer.length);
}
/**
* Updates the checksum with the bytes taken from the array.
*
* @param buf an array of bytes
* @param off the start of the data used for this update
* @param len the number of bytes to use for this update
*/
public void update (byte[] buf, int off, int len)
{
//(By Per Bothner)
int s1 = adler & 0xffff;
int s2 = adler >>> 16;
while (len > 0)
{
// We can defer the modulo operation:
// s1 maximally grows from 65521 to 65521 + 255 * 3800
// s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31
int n = 3800;
if (n > len)
n = len;
len -= n;
while (--n >= 0)
{
s1 = s1 + (buf[off++] & 0xFF);
s2 = s2 + s1;
}
s1 %= BASE;
s2 %= BASE;
}
/*Old implementation, borrowed from somewhere:
int n;
while (len-- > 0) {
s1 = (s1 + (bs[offset++] & 0xff)) % BASE;
s2 = (s2 + s1) % BASE;
}*/
adler = (s2 << 16) | s1;
}
/**
* Returns the Adler32 data checksum computed so far.
*/
public long getValue()
{
return (long) adler & 0xffffffffL;
}
}

View File

@@ -0,0 +1,132 @@
/* CRC32.java - Computes CRC32 data checksum of a data stream
Copyright (C) 1999. 2000, 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* The actual CRC32 algorithm is taken from RFC 1952.
* 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 DeflaterOutputStream
*
* @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. */
private static int[] make_crc_table ()
{
int[] crc_table = new int[256];
for (int n = 0; n < 256; n++)
{
int c = n;
for (int k = 8; --k >= 0; )
{
if ((c & 1) != 0)
c = 0xedb88320 ^ (c >>> 1);
else
c = c >>> 1;
}
crc_table[n] = c;
}
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; }
/**
* Updates the checksum with the int bval.
*
* @param bval (the byte is taken as the lower 8 bits of bval)
*/
public void update (int bval)
{
int c = ~crc;
c = crc_table[(c ^ bval) & 0xff] ^ (c >>> 8);
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;
while (--len >= 0)
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

@@ -0,0 +1,98 @@
/*
Copyright (C) 2013 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
package java.util.zip;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.LinkedHashMap;
final class ClassStubZipEntry extends ZipEntry
{
private final String zipFilePath;
ClassStubZipEntry(String zipFilePath, String name)
{
super(name);
this.zipFilePath = zipFilePath;
}
private File getFile()
{
return new File(new File(zipFilePath).getParentFile().getParentFile(), "classes" + File.separator + name);
}
public long getSize()
{
if (size == -1)
{
size = getFile().length();
}
return size;
}
public long getCompressedSize()
{
if (csize == -1)
{
csize = getSize();
}
return csize;
}
public long getCrc()
{
if (crc == -1)
{
crc = computeCrc();
}
return crc;
}
private long computeCrc()
{
try (InputStream in = getInputStream())
{
CRC32 crc = new CRC32();
int b;
while ((b = in.read()) != -1)
{
crc.update(b);
}
return crc.getValue();
}
catch (IOException _)
{
return 0;
}
}
final InputStream getInputStream() throws IOException
{
return new FileInputStream(getFile());
}
static native void expandIkvmClasses(ZipFile zipFile, LinkedHashMap<String, ZipEntry> entries);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
/* java.util.zip.DeflaterConstants
Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
interface DeflaterConstants
{
boolean DEBUGGING = false;
int STORED_BLOCK = 0;
int STATIC_TREES = 1;
int DYN_TREES = 2;
int PRESET_DICT = 0x20;
int DEFAULT_MEM_LEVEL = 8;
int MAX_MATCH = 258;
int MIN_MATCH = 3;
int MAX_WBITS = 15;
int WSIZE = 1 << MAX_WBITS;
int WMASK = WSIZE - 1;
int HASH_BITS = DEFAULT_MEM_LEVEL + 7;
int HASH_SIZE = 1 << HASH_BITS;
int HASH_MASK = HASH_SIZE - 1;
int HASH_SHIFT = (HASH_BITS + MIN_MATCH - 1) / MIN_MATCH;
int MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
int MAX_DIST = WSIZE - MIN_LOOKAHEAD;
int PENDING_BUF_SIZE = 1 << (DEFAULT_MEM_LEVEL + 8);
int MAX_BLOCK_SIZE = Math.min(65535, PENDING_BUF_SIZE-5);
int DEFLATE_STORED = 0;
int DEFLATE_FAST = 1;
int DEFLATE_SLOW = 2;
int GOOD_LENGTH[] = { 0,4, 4, 4, 4, 8, 8, 8, 32, 32 };
int MAX_LAZY[] = { 0,4, 5, 6, 4,16, 16, 32, 128, 258 };
int NICE_LENGTH[] = { 0,8,16,32,16,32,128,128, 258, 258 };
int MAX_CHAIN[] = { 0,4, 8,32,16,32,128,256,1024,4096 };
int COMPR_FUNC[] = { 0,1, 1, 1, 1, 2, 2, 2, 2, 2 };
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
/* java.util.zip.DeflaterPending
Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/**
* This class stores the pending output of the Deflater.
*
* @author Jochen Hoenicke
* @date Jan 5, 2000
*/
class DeflaterPending extends PendingBuffer
{
public DeflaterPending()
{
super(DeflaterConstants.PENDING_BUF_SIZE);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,203 @@
/* java.util.zip.InflaterDynHeader
Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
class InflaterDynHeader
{
private static final int LNUM = 0;
private static final int DNUM = 1;
private static final int BLNUM = 2;
private static final int BLLENS = 3;
private static final int LENS = 4;
private static final int REPS = 5;
private static final int repMin[] = { 3, 3, 11 };
private static final int repBits[] = { 2, 3, 7 };
private byte[] blLens;
private byte[] litdistLens;
private InflaterHuffmanTree blTree;
private int mode;
private int lnum, dnum, blnum, num;
private int repSymbol;
private byte lastLen;
private int ptr;
private static final int[] BL_ORDER =
{ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
public InflaterDynHeader()
{
}
public boolean decode(StreamManipulator input) throws DataFormatException
{
decode_loop:
for (;;)
{
switch (mode)
{
case LNUM:
lnum = input.peekBits(5);
if (lnum < 0)
return false;
lnum += 257;
input.dropBits(5);
// System.err.println("LNUM: "+lnum);
mode = DNUM;
/* fall through */
case DNUM:
dnum = input.peekBits(5);
if (dnum < 0)
return false;
dnum++;
input.dropBits(5);
// System.err.println("DNUM: "+dnum);
num = lnum+dnum;
litdistLens = new byte[num];
mode = BLNUM;
/* fall through */
case BLNUM:
blnum = input.peekBits(4);
if (blnum < 0)
return false;
blnum += 4;
input.dropBits(4);
blLens = new byte[19];
ptr = 0;
// System.err.println("BLNUM: "+blnum);
mode = BLLENS;
/* fall through */
case BLLENS:
while (ptr < blnum)
{
int len = input.peekBits(3);
if (len < 0)
return false;
input.dropBits(3);
// System.err.println("blLens["+BL_ORDER[ptr]+"]: "+len);
blLens[BL_ORDER[ptr]] = (byte) len;
ptr++;
}
blTree = new InflaterHuffmanTree(blLens);
blLens = null;
ptr = 0;
mode = LENS;
/* fall through */
case LENS:
{
int symbol;
while (((symbol = blTree.getSymbol(input)) & ~15) == 0)
{
/* Normal case: symbol in [0..15] */
// System.err.println("litdistLens["+ptr+"]: "+symbol);
litdistLens[ptr++] = lastLen = (byte) symbol;
if (ptr == num)
{
/* Finished */
return true;
}
}
/* need more input ? */
if (symbol < 0)
return false;
/* otherwise repeat code */
if (symbol >= 17)
{
/* repeat zero */
// System.err.println("repeating zero");
lastLen = 0;
}
else
{
if (ptr == 0)
throw new DataFormatException();
}
repSymbol = symbol-16;
mode = REPS;
}
/* fall through */
case REPS:
{
int bits = repBits[repSymbol];
int count = input.peekBits(bits);
if (count < 0)
return false;
input.dropBits(bits);
count += repMin[repSymbol];
// System.err.println("litdistLens repeated: "+count);
if (ptr + count > num)
throw new DataFormatException();
while (count-- > 0)
litdistLens[ptr++] = lastLen;
if (ptr == num)
{
/* Finished */
return true;
}
}
mode = LENS;
continue decode_loop;
}
}
}
public InflaterHuffmanTree buildLitLenTree() throws DataFormatException
{
byte[] litlenLens = new byte[lnum];
System.arraycopy(litdistLens, 0, litlenLens, 0, lnum);
return new InflaterHuffmanTree(litlenLens);
}
public InflaterHuffmanTree buildDistTree() throws DataFormatException
{
byte[] distLens = new byte[dnum];
System.arraycopy(litdistLens, lnum, distLens, 0, dnum);
return new InflaterHuffmanTree(distLens);
}
}

View File

@@ -0,0 +1,220 @@
/* InflaterHuffmanTree.java --
Copyright (C) 2001, 2004 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
class InflaterHuffmanTree
{
private static final int MAX_BITLEN = 15;
private short[] tree;
static InflaterHuffmanTree defLitLenTree, defDistTree;
static
{
try
{
byte[] codeLengths = new byte[288];
int i = 0;
while (i < 144)
codeLengths[i++] = 8;
while (i < 256)
codeLengths[i++] = 9;
while (i < 280)
codeLengths[i++] = 7;
while (i < 288)
codeLengths[i++] = 8;
defLitLenTree = new InflaterHuffmanTree(codeLengths);
codeLengths = new byte[32];
i = 0;
while (i < 32)
codeLengths[i++] = 5;
defDistTree = new InflaterHuffmanTree(codeLengths);
}
catch (DataFormatException ex)
{
throw new InternalError
("InflaterHuffmanTree: static tree length illegal");
}
}
/**
* Constructs a Huffman tree from the array of code lengths.
*
* @param codeLengths the array of code lengths
*/
InflaterHuffmanTree(byte[] codeLengths) throws DataFormatException
{
buildTree(codeLengths);
}
private void buildTree(byte[] codeLengths) throws DataFormatException
{
int[] blCount = new int[MAX_BITLEN+1];
int[] nextCode = new int[MAX_BITLEN+1];
for (int i = 0; i < codeLengths.length; i++)
{
int bits = codeLengths[i];
if (bits > 0)
blCount[bits]++;
}
int max = 0;
int code = 0;
int treeSize = 512;
for (int bits = 1; bits <= MAX_BITLEN; bits++)
{
nextCode[bits] = code;
if (blCount[bits] > 0)
max = bits;
code += blCount[bits] << (16 - bits);
if (bits >= 10)
{
/* We need an extra table for bit lengths >= 10. */
int start = nextCode[bits] & 0x1ff80;
int end = code & 0x1ff80;
treeSize += (end - start) >> (16 - bits);
}
}
if (code != 65536 && max > 1)
throw new DataFormatException("incomplete dynamic bit lengths tree");
/* Now create and fill the extra tables from longest to shortest
* bit len. This way the sub trees will be aligned.
*/
tree = new short[treeSize];
int treePtr = 512;
for (int bits = MAX_BITLEN; bits >= 10; bits--)
{
int end = code & 0x1ff80;
code -= blCount[bits] << (16 - bits);
int start = code & 0x1ff80;
for (int i = start; i < end; i += 1 << 7)
{
tree[DeflaterHuffman.bitReverse(i)]
= (short) ((-treePtr << 4) | bits);
treePtr += 1 << (bits-9);
}
}
for (int i = 0; i < codeLengths.length; i++)
{
int bits = codeLengths[i];
if (bits == 0)
continue;
code = nextCode[bits];
int revcode = DeflaterHuffman.bitReverse(code);
if (bits <= 9)
{
do
{
tree[revcode] = (short) ((i << 4) | bits);
revcode += 1 << bits;
}
while (revcode < 512);
}
else
{
int subTree = tree[revcode & 511];
int treeLen = 1 << (subTree & 15);
subTree = -(subTree >> 4);
do
{
tree[subTree | (revcode >> 9)] = (short) ((i << 4) | bits);
revcode += 1 << bits;
}
while (revcode < treeLen);
}
nextCode[bits] = code + (1 << (16 - bits));
}
}
/**
* Reads the next symbol from input. The symbol is encoded using the
* huffman tree.
* @param input the input source.
* @return the next symbol, or -1 if not enough input is available.
*/
int getSymbol(StreamManipulator input) throws DataFormatException
{
int lookahead, symbol;
if ((lookahead = input.peekBits(9)) >= 0)
{
if ((symbol = tree[lookahead]) >= 0)
{
input.dropBits(symbol & 15);
return symbol >> 4;
}
int subtree = -(symbol >> 4);
int bitlen = symbol & 15;
if ((lookahead = input.peekBits(bitlen)) >= 0)
{
symbol = tree[subtree | (lookahead >> 9)];
input.dropBits(symbol & 15);
return symbol >> 4;
}
else
{
int bits = input.getAvailableBits();
lookahead = input.peekBits(bits);
symbol = tree[subtree | (lookahead >> 9)];
if ((symbol & 15) <= bits)
{
input.dropBits(symbol & 15);
return symbol >> 4;
}
else
return -1;
}
}
else
{
int bits = input.getAvailableBits();
lookahead = input.peekBits(bits);
symbol = tree[lookahead];
if (symbol >= 0 && (symbol & 15) <= bits)
{
input.dropBits(symbol & 15);
return symbol >> 4;
}
else
return -1;
}
}
}

View File

@@ -0,0 +1,178 @@
/* OutputWindow.java --
Copyright (C) 2001, 2004 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/**
* Contains the output from the Inflation process.
*
* We need to have a window so that we can refer backwards into the output stream
* to repeat stuff.
*
* @author John Leuner
* @since 1.1
*/
class OutputWindow
{
private static final int WINDOW_SIZE = 1 << 15;
private static final int WINDOW_MASK = WINDOW_SIZE - 1;
private byte[] window = new byte[WINDOW_SIZE]; //The window is 2^15 bytes
private int window_end = 0;
private int window_filled = 0;
public void write(int abyte)
{
if (window_filled++ == WINDOW_SIZE)
throw new IllegalStateException("Window full");
window[window_end++] = (byte) abyte;
window_end &= WINDOW_MASK;
}
private void slowRepeat(int rep_start, int len, int dist)
{
while (len-- > 0)
{
window[window_end++] = window[rep_start++];
window_end &= WINDOW_MASK;
rep_start &= WINDOW_MASK;
}
}
public void repeat(int len, int dist)
{
if ((window_filled += len) > WINDOW_SIZE)
throw new IllegalStateException("Window full");
int rep_start = (window_end - dist) & WINDOW_MASK;
int border = WINDOW_SIZE - len;
if (rep_start <= border && window_end < border)
{
if (len <= dist)
{
System.arraycopy(window, rep_start, window, window_end, len);
window_end += len;
}
else
{
/* We have to copy manually, since the repeat pattern overlaps.
*/
while (len-- > 0)
window[window_end++] = window[rep_start++];
}
}
else
slowRepeat(rep_start, len, dist);
}
public int copyStored(StreamManipulator input, int len)
{
len = Math.min(Math.min(len, WINDOW_SIZE - window_filled),
input.getAvailableBytes());
int copied;
int tailLen = WINDOW_SIZE - window_end;
if (len > tailLen)
{
copied = input.copyBytes(window, window_end, tailLen);
if (copied == tailLen)
copied += input.copyBytes(window, 0, len - tailLen);
}
else
copied = input.copyBytes(window, window_end, len);
window_end = (window_end + copied) & WINDOW_MASK;
window_filled += copied;
return copied;
}
public void copyDict(byte[] dict, int offset, int len)
{
if (window_filled > 0)
throw new IllegalStateException();
if (len > WINDOW_SIZE)
{
offset += len - WINDOW_SIZE;
len = WINDOW_SIZE;
}
System.arraycopy(dict, offset, window, 0, len);
window_end = len & WINDOW_MASK;
}
public int getFreeSpace()
{
return WINDOW_SIZE - window_filled;
}
public int getAvailable()
{
return window_filled;
}
public int copyOutput(byte[] output, int offset, int len)
{
int copy_end = window_end;
if (len > window_filled)
len = window_filled;
else
copy_end = (window_end - window_filled + len) & WINDOW_MASK;
int copied = len;
int tailLen = len - copy_end;
if (tailLen > 0)
{
System.arraycopy(window, WINDOW_SIZE - tailLen,
output, offset, tailLen);
offset += tailLen;
len = copy_end;
}
System.arraycopy(window, copy_end - len, output, offset, len);
window_filled -= copied;
if (window_filled < 0)
throw new IllegalStateException();
return copied;
}
public void reset() {
window_filled = window_end = 0;
}
}

View File

@@ -0,0 +1,200 @@
/* java.util.zip.PendingBuffer
Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/**
* This class is general purpose class for writing data to a buffer.
*
* It allows you to write bits as well as bytes
*
* Based on DeflaterPending.java
*
* @author Jochen Hoenicke
* @date Jan 5, 2000
*/
class PendingBuffer
{
protected byte[] buf;
int start;
int end;
int bits;
int bitCount;
public PendingBuffer()
{
this( 4096 );
}
public PendingBuffer(int bufsize)
{
buf = new byte[bufsize];
}
public final void reset() {
start = end = bitCount = 0;
}
public final void writeByte(int b)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
buf[end++] = (byte) b;
}
public final void writeShort(int s)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
buf[end++] = (byte) s;
buf[end++] = (byte) (s >> 8);
}
public final void writeInt(int s)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
buf[end++] = (byte) s;
buf[end++] = (byte) (s >> 8);
buf[end++] = (byte) (s >> 16);
buf[end++] = (byte) (s >> 24);
}
public final void writeBlock(byte[] block, int offset, int len)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
System.arraycopy(block, offset, buf, end, len);
end += len;
}
public final int getBitCount() {
return bitCount;
}
public final void alignToByte() {
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
if (bitCount > 0)
{
buf[end++] = (byte) bits;
if (bitCount > 8)
buf[end++] = (byte) (bits >>> 8);
}
bits = 0;
bitCount = 0;
}
public final void writeBits(int b, int count)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
if (DeflaterConstants.DEBUGGING)
System.err.println("writeBits("+Integer.toHexString(b)+","+count+")");
bits |= b << bitCount;
bitCount += count;
if (bitCount >= 16) {
buf[end++] = (byte) bits;
buf[end++] = (byte) (bits >>> 8);
bits >>>= 16;
bitCount -= 16;
}
}
public final void writeShortMSB(int s) {
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
buf[end++] = (byte) (s >> 8);
buf[end++] = (byte) s;
}
public final boolean isFlushed() {
return end == 0;
}
/**
* Flushes the pending buffer into the given output array. If the
* output array is to small, only a partial flush is done.
*
* @param output the output array;
* @param offset the offset into output array;
* @param length the maximum number of bytes to store;
* @exception IndexOutOfBoundsException if offset or length are
* invalid.
*/
public final int flush(byte[] output, int offset, int length) {
if (bitCount >= 8)
{
buf[end++] = (byte) bits;
bits >>>= 8;
bitCount -= 8;
}
if (length > end - start)
{
length = end - start;
System.arraycopy(buf, start, output, offset, length);
start = 0;
end = 0;
}
else
{
System.arraycopy(buf, start, output, offset, length);
start += length;
}
return length;
}
/**
* Flushes the pending buffer and returns that data in a new array
*
* @return the output stream
*/
public final byte[] toByteArray()
{
byte[] ret = new byte[ end - start ];
System.arraycopy(buf, start, ret, 0, ret.length);
start = 0;
end = 0;
return ret;
}
}

View File

@@ -0,0 +1,216 @@
/* java.util.zip.StreamManipulator
Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
/**
* This class allows us to retrieve a specified amount of bits from
* the input buffer, as well as copy big byte blocks.
*
* It uses an int buffer to store up to 31 bits for direct
* manipulation. This guarantees that we can get at least 16 bits,
* but we only need at most 15, so this is all safe.
*
* There are some optimizations in this class, for example, you must
* never peek more then 8 bits more than needed, and you must first
* peek bits before you may drop them. This is not a general purpose
* class but optimized for the behaviour of the Inflater.
*
* @author John Leuner, Jochen Hoenicke
*/
class StreamManipulator
{
private byte[] window;
private int window_start = 0;
private int window_end = 0;
private int buffer = 0;
private int bits_in_buffer = 0;
/**
* Get the next n bits but don't increase input pointer. n must be
* less or equal 16 and if you if this call succeeds, you must drop
* at least n-8 bits in the next call.
*
* @return the value of the bits, or -1 if not enough bits available. */
public final int peekBits(int n)
{
if (bits_in_buffer < n)
{
if (window_start == window_end)
return -1;
buffer |= (window[window_start++] & 0xff
| (window[window_start++] & 0xff) << 8) << bits_in_buffer;
bits_in_buffer += 16;
}
return buffer & ((1 << n) - 1);
}
/* Drops the next n bits from the input. You should have called peekBits
* with a bigger or equal n before, to make sure that enough bits are in
* the bit buffer.
*/
public final void dropBits(int n)
{
buffer >>>= n;
bits_in_buffer -= n;
}
/**
* Gets the next n bits and increases input pointer. This is equivalent
* to peekBits followed by dropBits, except for correct error handling.
* @return the value of the bits, or -1 if not enough bits available.
*/
public final int getBits(int n)
{
int bits = peekBits(n);
if (bits >= 0)
dropBits(n);
return bits;
}
/**
* Gets the number of bits available in the bit buffer. This must be
* only called when a previous peekBits() returned -1.
* @return the number of bits available.
*/
public final int getAvailableBits()
{
return bits_in_buffer;
}
/**
* Gets the number of bytes available.
* @return the number of bytes available.
*/
public final int getAvailableBytes()
{
return window_end - window_start + (bits_in_buffer >> 3);
}
/**
* Skips to the next byte boundary.
*/
public void skipToByteBoundary()
{
buffer >>= (bits_in_buffer & 7);
bits_in_buffer &= ~7;
}
public final boolean needsInput() {
return window_start == window_end;
}
/* Copies length bytes from input buffer to output buffer starting
* at output[offset]. You have to make sure, that the buffer is
* byte aligned. If not enough bytes are available, copies fewer
* bytes.
* @param length the length to copy, 0 is allowed.
* @return the number of bytes copied, 0 if no byte is available.
*/
public int copyBytes(byte[] output, int offset, int length)
{
if (length < 0)
throw new IllegalArgumentException("length negative");
if ((bits_in_buffer & 7) != 0)
/* bits_in_buffer may only be 0 or 8 */
throw new IllegalStateException("Bit buffer is not aligned!");
int count = 0;
while (bits_in_buffer > 0 && length > 0)
{
output[offset++] = (byte) buffer;
buffer >>>= 8;
bits_in_buffer -= 8;
length--;
count++;
}
if (length == 0)
return count;
int avail = window_end - window_start;
if (length > avail)
length = avail;
System.arraycopy(window, window_start, output, offset, length);
window_start += length;
if (((window_start - window_end) & 1) != 0)
{
/* We always want an even number of bytes in input, see peekBits */
buffer = (window[window_start++] & 0xff);
bits_in_buffer = 8;
}
return count + length;
}
public StreamManipulator()
{
}
public void reset()
{
window_start = window_end = buffer = bits_in_buffer = 0;
}
public void setInput(byte[] buf, int off, int len)
{
if (window_start < window_end)
throw new IllegalStateException
("Old input was not completely processed");
int end = off + len;
/* We want to throw an ArrayIndexOutOfBoundsException early. The
* check is very tricky: it also handles integer wrap around.
*/
if (0 > off || off > end || end > buf.length)
throw new ArrayIndexOutOfBoundsException();
if ((len & 1) != 0)
{
/* We always want an even number of bytes in input, see peekBits */
buffer |= (buf[off++] & 0xff) << bits_in_buffer;
bits_in_buffer += 8;
}
window = buf;
window_start = off;
window_end = end;
}
}

View File

@@ -0,0 +1,330 @@
/* ZipEntry.java --
Copyright (C) 2001, 2002, 2004, 2005, 2011 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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
import java.util.Date;
/**
* This class represents a member of a zip archive. ZipFile and
* ZipInputStream will give you instances of this class as information
* about the members in an archive. On the other hand ZipOutputStream
* needs an instance of this class to create a new member.
*
* @author Jochen Hoenicke
*/
public class ZipEntry implements ZipConstants, Cloneable
{
String name;
long time = -1;
long crc = -1;
long size = -1;
long csize = -1;
int method = -1;
int flag;
byte[] extra;
String comment;
long offset; /* used by ZipFile */
/**
* Compression method. This method doesn't compress at all.
*/
public static final int STORED = 0;
/**
* Compression method. This method uses the Deflater.
*/
public static final int DEFLATED = 8;
/**
* Creates a zip entry with the given name.
* @param name the name. May include directory components separated
* by '/'.
*
* @exception NullPointerException when name is null.
* @exception IllegalArgumentException when name is bigger then 65535 chars.
*/
public ZipEntry(String name)
{
int length = name.length();
if (length > 65535)
throw new IllegalArgumentException("name length is " + length);
this.name = name;
}
/**
* Creates a copy of the given zip entry.
* @param e the entry to copy.
*/
public ZipEntry(ZipEntry e)
{
name = e.name;
time = e.time;
crc = e.crc;
size = e.size;
csize = e.csize;
method = e.method;
flag = e.flag;
extra = e.extra;
comment = e.comment;
}
ZipEntry()
{
}
/**
* Creates a copy of this zip entry.
*/
/**
* Clones the entry.
*/
public Object clone()
{
try
{
// The JCL says that the `extra' field is also copied.
ZipEntry clone = (ZipEntry)super.clone();
if (extra != null)
clone.extra = (byte[])extra.clone();
return clone;
}
catch (CloneNotSupportedException ex)
{
throw new InternalError();
}
}
/**
* Returns the entry name. The path components in the entry are
* always separated by slashes ('/').
*/
public String getName()
{
return name;
}
/**
* Sets the time of last modification of the entry.
* @time the time of last modification of the entry.
*/
public void setTime(long time)
{
Date d = new Date(time);
if (d.getYear() < 80)
{
d = new Date(80, 0, 1);
}
this.time = ((d.getYear() - 80) << 25)
| ((d.getMonth() + 1) << 21)
| (d.getDate() << 16)
| (d.getHours() << 11)
| (d.getMinutes() << 5)
| (d.getSeconds() >> 1);
}
/**
* Gets the time of last modification of the entry.
* @return the time of last modification of the entry, or -1 if unknown.
*/
public long getTime()
{
if (time == -1)
{
return -1;
}
Date d = new Date((int)(((time >> 25) & 0x7f) + 80),
(int)(((time >> 21) & 0x0f) - 1),
(int)((time >> 16) & 0x1f),
(int)((time >> 11) & 0x1f),
(int)((time >> 5) & 0x3f),
(int)((time << 1) & 0x3e));
return d.getTime();
}
/**
* Sets the size of the uncompressed data.
* @exception IllegalArgumentException if size is negative.
*/
public void setSize(long size)
{
if (size < 0)
throw new IllegalArgumentException();
this.size = size;
}
/**
* Gets the size of the uncompressed data.
* @return the size or -1 if unknown.
*/
public long getSize()
{
return size;
}
/**
* Sets the size of the compressed data.
*/
public void setCompressedSize(long csize)
{
this.csize = csize;
}
/**
* Gets the size of the compressed data.
* @return the size or -1 if unknown.
*/
public long getCompressedSize()
{
return csize;
}
/**
* Sets the crc of the uncompressed data.
* @exception IllegalArgumentException if crc is not in 0..0xffffffffL
*/
public void setCrc(long crc)
{
if ((crc & 0xffffffff00000000L) != 0)
throw new IllegalArgumentException();
this.crc = crc;
}
/**
* Gets the crc of the uncompressed data.
* @return the crc or -1 if unknown.
*/
public long getCrc()
{
return crc;
}
/**
* Sets the compression method. Only DEFLATED and STORED are
* supported.
* @exception IllegalArgumentException if method is not supported.
* @see ZipOutputStream#DEFLATED
* @see ZipOutputStream#STORED
*/
public void setMethod(int method)
{
if (method != ZipOutputStream.STORED
&& method != ZipOutputStream.DEFLATED)
throw new IllegalArgumentException();
this.method = method;
}
/**
* Gets the compression method.
* @return the compression method or -1 if unknown.
*/
public int getMethod()
{
return method;
}
/**
* Sets the extra data.
* @exception IllegalArgumentException if extra is longer than 0xffff bytes.
*/
public void setExtra(byte[] extra)
{
if (extra == null)
{
this.extra = null;
return;
}
if (extra.length > 0xffff)
throw new IllegalArgumentException();
this.extra = extra;
}
/**
* Gets the extra data.
* @return the extra data or null if not set.
*/
public byte[] getExtra()
{
return extra;
}
/**
* Sets the entry comment.
*/
public void setComment(String comment)
{
this.comment = comment;
}
/**
* Gets the comment.
* @return the comment or null if not set.
*/
public String getComment()
{
return comment;
}
/**
* Gets true, if the entry is a directory. This is solely
* determined by the name, a trailing slash '/' marks a directory.
*/
public boolean isDirectory()
{
int nlen = name.length();
return nlen > 0 && name.charAt(nlen - 1) == '/';
}
/**
* Gets the string representation of this ZipEntry. This is just
* the name as returned by getName().
*/
public String toString()
{
return getName();
}
/**
* Gets the hashCode of this ZipEntry. This is just the hashCode
* of the name. Note that the equals method isn't changed, though.
*/
public int hashCode()
{
return name.hashCode();
}
}

File diff suppressed because it is too large Load Diff