cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java
Date Mon, 26 Apr 2004 21:28:39 GMT
ugo         2004/04/26 14:28:39

  Modified:    src/java/org/apache/cocoon/components/pipeline/impl
                        AbstractCachingProcessingPipeline.java
               src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  Optimized away unnecessary array allocation and copying.
  
  Revision  Changes    Path
  1.19      +5 -7      cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
  
  Index: AbstractCachingProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractCachingProcessingPipeline.java	3 Apr 2004 00:46:33 -0000	1.18
  +++ AbstractCachingProcessingPipeline.java	26 Apr 2004 21:28:39 -0000	1.19
  @@ -243,9 +243,8 @@
                           } else {
                               this.generator.generate();
                           }
  -                        byte[] data = baos.toByteArray();
  -                        environment.setContentLength(data.length);
  -                        os.write(data);
  +                        environment.setContentLength(baos.size());
  +                        baos.writeTo(os);
                       } else {
                           if (os == null) {
                               os = environment.getOutputStream(
  @@ -798,12 +797,11 @@
                       ByteArrayOutputStream os = new ByteArrayOutputStream();
                       this.reader.setOutputStream(os);
                       this.reader.generate();
  -                    byte[] data = os.toByteArray();
  -                    environment.setContentLength(data.length);
  +                    environment.setContentLength(os.size());
                       if (outputStream == null) {
                           outputStream = environment.getOutputStream(0);
                       }
  -                    environment.getOutputStream(0).write(data);
  +                    os.writeTo(environment.getOutputStream(0));
                   } else {
                       if (outputStream == null) {
                           outputStream = environment.getOutputStream(this.outputBufferSize);
  
  
  
  1.21      +5 -7      cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AbstractProcessingPipeline.java	8 Mar 2004 12:07:39 -0000	1.20
  +++ AbstractProcessingPipeline.java	26 Apr 2004 21:28:39 -0000	1.21
  @@ -536,9 +536,8 @@
       
                       // execute the pipeline:
                       this.generator.generate();
  -                    byte[] data = os.toByteArray();
  -                    environment.setContentLength(data.length);
  -                    environment.getOutputStream(0).write(data);
  +                    environment.setContentLength(os.size());
  +                    os.writeTo(environment.getOutputStream(0));
                   } else {
                       // set the output stream
                       this.serializer.setOutputStream(environment.getOutputStream(this.outputBufferSize));
  @@ -602,9 +601,8 @@
                   ByteArrayOutputStream os = new ByteArrayOutputStream();
                   this.reader.setOutputStream(os);
                   this.reader.generate();
  -                byte[] data = os.toByteArray();
  -                environment.setContentLength(data.length);
  -                environment.getOutputStream(0).write(data);
  +                environment.setContentLength(os.size());
  +                os.writeTo(environment.getOutputStream(0));
               } else {
                   this.reader.setOutputStream(environment.getOutputStream(this.outputBufferSize));
                   this.reader.generate();
  
  
  

Mime
View raw message