cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgaw...@apache.org
Subject svn commit: r439054 - /cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
Date Thu, 31 Aug 2006 21:34:28 GMT
Author: lgawron
Date: Thu Aug 31 14:34:27 2006
New Revision: 439054

URL: http://svn.apache.org/viewvc?rev=439054&view=rev
Log:
use BufferedOutputStream instead of caching into memory
it is probably also not a proper way to check for 'end of stream' with stream.available()
== 0

Modified:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java?rev=439054&r1=439053&r2=439054&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
Thu Aug 31 14:34:27 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.maven.deployer.monolithic;
 
+import java.io.BufferedOutputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -75,30 +76,22 @@
                         continue;
                     }
                     OutputStream out = null;
-	                    try {               	
-	                    	FileDeployer fileDeployer = findFileDeployer(document.getName());
-	                    	if(fileDeployer == null) {
-	                    		continue;
-	                    	}
-	                    	
-	                    	out = fileDeployer.writeResource(document.getName());
-		                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		                    // loop over ZIP entry stream
-		                    byte[] buffer = new byte[8192];
-		                    int length = -1;
-		                    while (zipStream.available() > 0) {
-		                        length = zipStream.read(buffer, 0, 8192);
-		                        if (length > 0) {
-		                            baos.write(buffer, 0, length);
-		                        }
-		                    }
-		                    // write it to the output stream provided by the file resource manager
-		                    out.write(baos.toByteArray());
-	                    } finally {
-	                    	if(out != null) {
-	                    		out.close();
-	                    	}
-	                    }
+                    try {
+                        FileDeployer fileDeployer = findFileDeployer(document.getName());
+                        if (fileDeployer == null) {
+                            continue;
+                        }
+
+                        out = new BufferedOutputStream(fileDeployer.writeResource(document.getName()));
+                        byte[] buffer = new byte[8192];
+                        int length;
+                        while ((length = zipStream.read(buffer)) > 0)
+                            out.write(buffer, 0, length);
+                    } finally {
+                        if (out != null) {
+                            out.close();
+                        }
+                    }
                     // go to next entry
                     zipStream.closeEntry();
                 }



Mime
View raw message