harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r823124 - in /harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util: jar/JarFile.java zip/CheckedInputStream.java zip/InflaterInputStream.java zip/ZipInputStream.java
Date Thu, 08 Oct 2009 11:05:52 GMT
Author: tellison
Date: Thu Oct  8 11:05:51 2009
New Revision: 823124

URL: http://svn.apache.org/viewvc?rev=823124&view=rev
Log:
Be a bit smarter about the size of discard buffer used when skipping bytes in the input stream.

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java?rev=823124&r1=823123&r2=823124&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
Thu Oct  8 11:05:51 2009
@@ -137,7 +137,7 @@
         @Override
         public long skip(long nbytes) throws IOException {
             long cnt = 0, rem = 0;
-            byte[] buf = new byte[4096];
+            byte[] buf = new byte[(int)Math.min(nbytes, 2048L)];
             while (cnt < nbytes) {
                 int x = read(buf, 0,
                         (rem = nbytes - cnt) > buf.length ? buf.length

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java?rev=823124&r1=823123&r2=823124&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/CheckedInputStream.java
Thu Oct  8 11:05:51 2009
@@ -114,7 +114,7 @@
             return 0;
         }
         long skipped = 0;
-        byte[] b = new byte[2048];
+        byte[] b = new byte[(int)Math.min(nbytes, 2048L)];
         int x, v;
         while (skipped != nbytes) {
             x = in.read(b, 0,

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java?rev=823124&r1=823123&r2=823124&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/InflaterInputStream.java
Thu Oct  8 11:05:51 2009
@@ -229,7 +229,7 @@
     public long skip(long nbytes) throws IOException {
         if (nbytes >= 0) {
             if (buf == null) {
-                buf = new byte[BUF_SIZE];
+                buf = new byte[(int)Math.min(nbytes, BUF_SIZE)];
             }
             long count = 0, rem = 0;
             while (count < nbytes) {

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java?rev=823124&r1=823123&r2=823124&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipInputStream.java
Thu Oct  8 11:05:51 2009
@@ -373,7 +373,7 @@
         }
 
         long skipped = 0;
-        byte[] b = new byte[1024];
+        byte[] b = new byte[(int)Math.min(value, 2048L)];
         while (skipped != value) {
             long rem = value - skipped;
             int x = read(b, 0, (int) (b.length > rem ? rem : b.length));



Mime
View raw message