Commit 57b4edef by Mark Wielaard Committed by Mark Wielaard

Reported by Helmer Kraemer <hkraemer@freenet.de>

       Reported by Helmer Kraemer <hkraemer@freenet.de>
       * java/util/jar/JarInputStream.java (readManifest): Don't call
       closeEntry().

       * java/util/zip/DeflaterOutputStream.java (inbufWrite): New method.
       (finish): Use inbufWrite().
       (write(int)): Likewise.
       (write(byte[],int,int)): Likewise.

From-SVN: r72976
parent b19ee4bd
2003-10-26 Mark Wielaard <mark@klomp.org>
Reported by Helmer Kraemer <hkraemer@freenet.de>
* java/util/jar/JarInputStream.java (readManifest): Don't call
closeEntry().
* java/util/zip/DeflaterOutputStream.java (inbufWrite): New method.
(finish): Use inbufWrite().
(write(int)): Likewise.
(write(byte[],int,int)): Likewise.
2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> 2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz>
* java/lang/reflect/AccessibleObject.java (secureSetAccessible): * java/lang/reflect/AccessibleObject.java (secureSetAccessible):
......
...@@ -116,7 +116,6 @@ public class JarInputStream extends ZipInputStream ...@@ -116,7 +116,6 @@ public class JarInputStream extends ZipInputStream
} }
firstEntry = (JarEntry) super.getNextEntry(); firstEntry = (JarEntry) super.getNextEntry();
} }
closeEntry();
if (verify) if (verify)
{ {
......
...@@ -127,12 +127,7 @@ public class DeflaterOutputStream extends FilterOutputStream ...@@ -127,12 +127,7 @@ public class DeflaterOutputStream extends FilterOutputStream
*/ */
public void finish () throws IOException public void finish () throws IOException
{ {
if (inbufLength > 0) inbufWrite();
{
def.setInput (inbuf, 0, inbufLength);
deflate ();
inbufLength = 0;
}
def.finish(); def.finish();
while (! def.finished ()) while (! def.finished ())
{ {
...@@ -145,28 +140,27 @@ public class DeflaterOutputStream extends FilterOutputStream ...@@ -145,28 +140,27 @@ public class DeflaterOutputStream extends FilterOutputStream
public void write (int bval) throws IOException public void write (int bval) throws IOException
{ {
if (inbuf == null) if (inbuf == null)
{ inbuf = new byte[128];
inbuf = new byte[128];
}
else if (inbufLength == inbuf.length) else if (inbufLength == inbuf.length)
{ inbufWrite ();
def.setInput (inbuf, 0, inbufLength);
deflate ();
inbufLength = 0;
}
inbuf[inbufLength++] = (byte) bval; inbuf[inbufLength++] = (byte) bval;
} }
public void write (byte[] buf, int off, int len) throws IOException public void write (byte[] buf, int off, int len) throws IOException
{ {
inbufWrite ();
def.setInput (buf, off, len);
deflate ();
}
private void inbufWrite () throws IOException
{
if (inbufLength > 0) if (inbufLength > 0)
{ {
def.setInput (inbuf, 0, inbufLength); int size = inbufLength;
deflate ();
inbufLength = 0; inbufLength = 0;
write (inbuf, 0, size);
} }
def.setInput (buf, off, len);
deflate ();
} }
// Used, if needed, for write(int). // Used, if needed, for write(int).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment