vgritsenko    2002/07/29 18:49:22

  Modified:    src/java/org/apache/cocoon/serialization
                        AbstractTextSerializer.java
  Log:
  buffer output only when buffer size is greater than 0; flush buffer at the end
  
  Revision  Changes    Path
  1.13      +19 -6     
xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
  
  Index: AbstractTextSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractTextSerializer.java       19 Jul 2002 13:09:32 -0000      1.12
  +++ AbstractTextSerializer.java       30 Jul 2002 01:49:22 -0000      1.13
  @@ -79,6 +79,7 @@
   import java.io.OutputStream;
   import java.io.BufferedOutputStream;
   import java.io.StringWriter;
  +import java.io.IOException;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a>
  @@ -192,8 +193,12 @@
            * transfer encoding this would otherwise lead to a whopping 6-fold
            * increase of data on the wire.
            */
  -        BufferedOutputStream streamBuffer = new BufferedOutputStream(out, 
outputBufferSize);
  -        super.setOutputStream(streamBuffer);
  +        if (outputBufferSize > 0) {
  +            super.setOutputStream(
  +              new BufferedOutputStream(out, outputBufferSize));
  +        } else {
  +            super.setOutputStream(out);
  +        }
       }
   
       /**
  @@ -262,12 +267,20 @@
           }
       }
   
  -     public void recycle() {
  +    public void recycle() {
  +        if (this.output != null) {
  +            try {
  +                this.output.flush();
  +            } catch (IOException ignored) {
  +            }
  +        }
  +        
           super.recycle();
   
  -        if (this.namespacePipe!=null)
  +        if (this.namespacePipe != null) {
               this.namespacePipe.recycle();
  -     }
  +        }
  +    }
   
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to