[jsword-svn] r2027 - trunk/jsword/src/main/java/org/crosswire/common/compress

dmsmith at crosswire.org dmsmith at crosswire.org
Fri Nov 26 04:33:50 MST 2010


Author: dmsmith
Date: 2010-11-26 04:33:50 -0700 (Fri, 26 Nov 2010)
New Revision: 2027

Modified:
   trunk/jsword/src/main/java/org/crosswire/common/compress/Zip.java
Log:
JS-132: Improve the memory usage of o.c.c.compress.Zip. Thanks to Martin Denham.

Modified: trunk/jsword/src/main/java/org/crosswire/common/compress/Zip.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/common/compress/Zip.java	2010-11-25 13:56:53 UTC (rev 2026)
+++ trunk/jsword/src/main/java/org/crosswire/common/compress/Zip.java	2010-11-26 11:33:50 UTC (rev 2027)
@@ -23,7 +23,6 @@
 package org.crosswire.common.compress;
 
 import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -33,9 +32,7 @@
 import java.util.zip.InflaterInputStream;
 
 /**
- * A class can be Activatable if it needs a significant amount of memory on an
- * irregular basis, and so would benefit from being told when to wake-up and
- * when to conserver memory.
+ * Zip manages the compression and uncompression of Zip files.
  * 
  * @see gnu.lgpl.License for license details.<br>
  *      The copyright to this program is held by it's authors.
@@ -87,8 +84,7 @@
      * @see org.crosswire.common.compress.Compressor#uncompress(int)
      */
     public ByteArrayOutputStream uncompress(int expectedLength) throws IOException {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        BufferedOutputStream out = new BufferedOutputStream(bos, expectedLength);
+        ByteArrayOutputStream out = new ByteArrayOutputStream(expectedLength);
         InflaterInputStream in = new InflaterInputStream(input, new Inflater(), expectedLength);
         byte[] buf = new byte[expectedLength];
 
@@ -98,7 +94,7 @@
         in.close();
         out.flush();
         out.close();
-        return bos;
+        return out;
     }
 
 }




More information about the jsword-svn mailing list