ZipInputStream.java (fill): New method.

* java/util/zip/ZipInputStream.java (fill): New method.
	(compressed_len): New instance variable.
	(getNextStream): Set it.
	(read): Reset inflater on EOF.  Only read via `super' if entry is
	deflated.
	(skip): Only skip via `super' if entry is deflated.
	* java/util/zip/Deflater.java (last_input_count): Removed.
	* java/util/zip/natDeflater.cc (deflate): Return 0 if input array
	is length 0.
	(needsInput): Don't use last_input_count.
	(setInput): Don't set last_input_count.
	* java/util/zip/natInflater.cc (getRemaining): Return correct
	result.
	(inflate): Return 0 if input array is length 0.
	(setInput): Don't set last_input_count.
	* java/util/zip/Inflater.java (last_input_count): Removed.

From-SVN: r27105
This commit is contained in:
Tom Tromey 1999-05-22 18:08:46 +00:00 committed by Tom Tromey
parent 5256aa37b4
commit 93d627acaa
6 changed files with 68 additions and 18 deletions

View file

@ -41,6 +41,9 @@ java::util::zip::Deflater::deflate (jbyteArray buf, jint off, jint len)
if (off < 0 || len < 0 || off + len > buf->length)
_Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
if (len == 0)
return 0;
s->next_out = (Bytef *) (elements (buf) + off);
s->avail_out = len;
@ -111,7 +114,7 @@ java::util::zip::Deflater::needsInput ()
{
JvSynchronize sync (this);
z_streamp s = (z_streamp) zstream;
return s->avail_in - last_input_count == 0;
return s->avail_in == 0;
}
void
@ -150,7 +153,6 @@ java::util::zip::Deflater::setInput (jbyteArray buf, jint off, jint len)
if (off < 0 || len < 0 || off + len > buf->length)
_Jv_Throw (new java::lang::ArrayIndexOutOfBoundsException);
last_input_count = len;
s->next_in = (Bytef *) (elements (buf) + off);
s->avail_in = len;
}