Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow
In directory 
james.mmbase.org:/tmp/cvs-serv952/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow

Modified Files:
      Tag: MMBase-1_8
        IncludeTag.java 
Log Message:
 MMB-1806 Improve io stream copy performance


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow
See also: http://www.mmbase.org/jira/browse/MMB-1806


Index: IncludeTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow/IncludeTag.java,v
retrieving revision 1.66.2.9
retrieving revision 1.66.2.10
diff -u -b -r1.66.2.9 -r1.66.2.10
--- IncludeTag.java     14 Mar 2008 16:59:42 -0000      1.66.2.9
+++ IncludeTag.java     7 Apr 2009 08:23:12 -0000       1.66.2.10
@@ -35,7 +35,7 @@
  *
  * @author Michiel Meeuwissen
  * @author Johannes Verelst
- * @version $Id: IncludeTag.java,v 1.66.2.9 2008/03/14 16:59:42 michiel Exp $
+ * @version $Id: IncludeTag.java,v 1.66.2.10 2009/04/07 08:23:12 nklasens Exp $
  */
 
 public class IncludeTag extends UrlTag {
@@ -159,11 +159,7 @@
                     log.debug("Found content encoding " + encoding);
                     ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                     InputStream inputStream = connection.getInputStream();
-                    int c = inputStream.read();
-                    while (c != -1) {
-                        bytes.write(c);
-                        c = inputStream.read();
-                    }
+                    IOUtil.copy(inputStream, bytes);
                     byte[] allBytes = bytes.toByteArray();
                     if (encoding == null || encoding.equals("")) {
                         String contentType = connection.getContentType();
@@ -381,11 +377,7 @@
                 handleResponse(404, "No such resource to cite " + resource, 
resource);
             } else {
                 StringWriter writer = new StringWriter();
-                while (true) {
-                    int c = reader.read();
-                    if (c == -1) break;
-                    writer.write(c);
-                }
+                IOUtil.copy(reader, writer);
                 handleResponse(200, writer.toString(), resource);
             }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to