+2004-07-30 Michael Koch <konqueror@gmx.de>
+
+ * java/util/zip/GZIPInputStream.java
+ (GZIPInputStream): Increase buffer size to 4k.
+ * java/util/zip/GZIPOutputStream.java
+ (GZIPOutputStream): Likewise.
+ * java/util/zip/Inflater.java
+ (setInput): Merged formating with GNU classpath.
+ * java/util/zip/InflaterInputStream.java
+ (InflaterInputStream): Increase buffer size to 4k.
+ (fill): Throw exception if stream ends early.
+ (read): Merged endless-loop with GNU classpath.
+ (skip): Increase buffer size to 2k.
+
2004-07-30 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
* @param buffer the input.
* @exception IllegalStateException if no input is needed.
*/
- public void setInput (byte[] buf)
+ public void setInput (byte[] buf)
{
setInput (buf, 0, buf.length);
}
*/
public InflaterInputStream(InputStream in)
{
- this(in, new Inflater(), 512);
+ this(in, new Inflater(), 4096);
}
/**
*/
public InflaterInputStream(InputStream in, Inflater inf)
{
- this(in, inf, 512);
+ this(in, inf, 4096);
}
/**
len = in.read(buf, 0, buf.length);
- if (len != -1)
- inf.setInput(buf, 0, len);
+ if (len < 0)
+ throw new ZipException("Deflated stream ends early.");
+
+ inf.setInput(buf, 0, len);
}
/**
return -1;
int count = 0;
- while (count == 0)
+ for (;;)
{
if (inf.needsInput())
fill();
{
throw new ZipException(dfe.getMessage());
}
+
+ if (count > 0)
+ return count;
}
- return count;
}
/**
if (n == 0)
return 0;
- int buflen = (int) Math.min(n, 1024);
+ int buflen = (int) Math.min(n, 2048);
byte[] tmpbuf = new byte[buflen];
long skipped = 0L;
while (n > 0L)
{
int numread = read(tmpbuf, 0, buflen);
- if (numread == -1)
+ if (numread <= 0)
break;
n -= numread;
skipped += numread;
- buflen = (int) Math.min(n, 1024);
+ buflen = (int) Math.min(n, 2048);
}
return skipped;