Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale.
* sources.am: Regenerated.
* gcj/javaprims.h: Regenerated.
* Makefile.in: Regenerated.
* gcj/Makefile.in: Regenerated.
* include/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* gnu/java/lang/VMInstrumentationImpl.java: New override.
* gnu/java/net/local/LocalSocketImpl.java: Likewise.
* gnu/classpath/jdwp/VMMethod.java: Likewise.
* gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest
interface.
* java/lang/Thread.java: Add UncaughtExceptionHandler.
* java/lang/reflect/Method.java: Implements GenericDeclaration and
isSynthetic(),
* java/lang/reflect/Field.java: Likewise.
* java/lang/reflect/Constructor.java
* java/lang/Class.java: Implements Type, GenericDeclaration,
getSimpleName() and getEnclosing*() methods.
* java/lang/Class.h: Add new public methods.
* java/lang/Math.java: Add signum(), ulp() and log10().
* java/lang/natMath.cc (log10): New function.
* java/security/VMSecureRandom.java: New override.
* java/util/logging/Logger.java: Updated to latest classpath
version.
* java/util/logging/LogManager.java: New override.
From-SVN: r113887
This commit is contained in:
@@ -221,7 +221,6 @@ public class Deflater
|
||||
* where the compressor allocates native memory.
|
||||
* If you call any method (even reset) afterwards the behaviour is
|
||||
* <i>undefined</i>.
|
||||
* @deprecated Just clear all references to deflater instead.
|
||||
*/
|
||||
public void end()
|
||||
{
|
||||
|
||||
@@ -497,7 +497,7 @@ class DeflaterEngine implements DeflaterConstants
|
||||
throw new InternalError();
|
||||
}
|
||||
}
|
||||
huffman.tallyDist(strstart - matchStart, matchLen);
|
||||
boolean full = huffman.tallyDist(strstart - matchStart, matchLen);
|
||||
|
||||
lookahead -= matchLen;
|
||||
if (matchLen <= max_lazy && lookahead >= MIN_MATCH)
|
||||
@@ -516,7 +516,8 @@ class DeflaterEngine implements DeflaterConstants
|
||||
updateHash();
|
||||
}
|
||||
matchLen = MIN_MATCH - 1;
|
||||
continue;
|
||||
if (!full)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -207,7 +207,7 @@ public class GZIPInputStream
|
||||
|
||||
/* 2. Check the compression type (must be 8) */
|
||||
int CM = in.read();
|
||||
if (CM != 8)
|
||||
if (CM != Deflater.DEFLATED)
|
||||
throw new IOException("Error in GZIP header, data not in deflate format");
|
||||
headCRC.update(CM);
|
||||
|
||||
|
||||
@@ -199,7 +199,6 @@ public class Inflater
|
||||
* with Sun's JDK, where the compressor allocates native memory.
|
||||
* If you call any method (even reset) afterwards the behaviour is
|
||||
* <i>undefined</i>.
|
||||
* @deprecated Just clear all references to inflater instead.
|
||||
*/
|
||||
public void end ()
|
||||
{
|
||||
|
||||
@@ -85,9 +85,6 @@ interface ZipConstants
|
||||
long ENDSIG = 'P'|('K'<<8)|(5<<16)|(6<<24);
|
||||
int ENDHDR = 22;
|
||||
|
||||
/* The following two fields are missing in SUN JDK */
|
||||
int ENDNRD = 4;
|
||||
int ENDDCD = 6;
|
||||
int ENDSUB = 8;
|
||||
int ENDTOT = 10;
|
||||
int ENDSIZ = 12;
|
||||
|
||||
@@ -43,6 +43,7 @@ import gnu.java.util.EmptyEnumeration;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
@@ -75,6 +76,11 @@ public class ZipFile implements ZipConstants
|
||||
*/
|
||||
public static final int OPEN_DELETE = 0x4;
|
||||
|
||||
/**
|
||||
* This field isn't defined in the JDK's ZipConstants, but should be.
|
||||
*/
|
||||
static final int ENDNRD = 4;
|
||||
|
||||
// Name of this zip file.
|
||||
private final String name;
|
||||
|
||||
@@ -86,6 +92,37 @@ public class ZipFile implements ZipConstants
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to open RandomAccessFile and throw the proper
|
||||
* ZipException in case opening the file fails.
|
||||
*
|
||||
* @param name the file name, or null if file is provided
|
||||
*
|
||||
* @param file the file, or null if name is provided
|
||||
*
|
||||
* @return the newly open RandomAccessFile, never null
|
||||
*/
|
||||
private RandomAccessFile openFile(String name,
|
||||
File file)
|
||||
throws ZipException, IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
return
|
||||
(name != null)
|
||||
? new RandomAccessFile(name, "r")
|
||||
: new RandomAccessFile(file, "r");
|
||||
}
|
||||
catch (FileNotFoundException f)
|
||||
{
|
||||
ZipException ze = new ZipException(f.getMessage());
|
||||
ze.initCause(f);
|
||||
throw ze;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens a Zip file with the given name for reading.
|
||||
* @exception IOException if a i/o error occured.
|
||||
@@ -94,7 +131,7 @@ public class ZipFile implements ZipConstants
|
||||
*/
|
||||
public ZipFile(String name) throws ZipException, IOException
|
||||
{
|
||||
this.raf = new RandomAccessFile(name, "r");
|
||||
this.raf = openFile(name,null);
|
||||
this.name = name;
|
||||
checkZipFile();
|
||||
}
|
||||
@@ -107,7 +144,7 @@ public class ZipFile implements ZipConstants
|
||||
*/
|
||||
public ZipFile(File file) throws ZipException, IOException
|
||||
{
|
||||
this.raf = new RandomAccessFile(file, "r");
|
||||
this.raf = openFile(null,file);
|
||||
this.name = file.getPath();
|
||||
checkZipFile();
|
||||
}
|
||||
@@ -134,7 +171,7 @@ public class ZipFile implements ZipConstants
|
||||
throw new IllegalArgumentException("invalid mode");
|
||||
if ((mode & OPEN_DELETE) != 0)
|
||||
file.deleteOnExit();
|
||||
this.raf = new RandomAccessFile(file, "r");
|
||||
this.raf = openFile(null,file);
|
||||
this.name = file.getPath();
|
||||
checkZipFile();
|
||||
}
|
||||
@@ -408,7 +445,19 @@ public class ZipFile implements ZipConstants
|
||||
case ZipOutputStream.STORED:
|
||||
return inp;
|
||||
case ZipOutputStream.DEFLATED:
|
||||
return new InflaterInputStream(inp, new Inflater(true));
|
||||
final Inflater inf = new Inflater(true);
|
||||
final int sz = (int) entry.getSize();
|
||||
return new InflaterInputStream(inp, inf)
|
||||
{
|
||||
public int available() throws IOException
|
||||
{
|
||||
if (sz == -1)
|
||||
return super.available();
|
||||
if (super.available() != 0)
|
||||
return sz - inf.getTotalOut();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
default:
|
||||
throw new ZipException("Unknown compression method " + method);
|
||||
}
|
||||
@@ -514,6 +563,7 @@ public class ZipFile implements ZipConstants
|
||||
pos = 0;
|
||||
fillBuffer();
|
||||
}
|
||||
|
||||
return buffer[pos++] & 0xFF;
|
||||
}
|
||||
|
||||
@@ -544,7 +594,7 @@ public class ZipFile implements ZipConstants
|
||||
len -= remain;
|
||||
totalBytesRead += remain;
|
||||
}
|
||||
|
||||
|
||||
return totalBytesRead;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user