vgritsenko 2002/07/29 18:49:22
Modified: src/java/org/apache/cocoon/serialization Tag:
cocoon_2_0_3_branch AbstractTextSerializer.java
Log:
buffer output only when buffer size is greater than 0; flush buffer at the end
Revision Changes Path
No revision
No revision
1.9.2.1 +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.9
retrieving revision 1.9.2.1
diff -u -r1.9 -r1.9.2.1
--- AbstractTextSerializer.java 22 Feb 2002 07:03:55 -0000 1.9
+++ AbstractTextSerializer.java 30 Jul 2002 01:49:22 -0000 1.9.2.1
@@ -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>
@@ -180,8 +181,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);
+ }
}
/**
@@ -250,12 +255,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]