costin 01/05/26 10:18:20
Modified: src/share/org/apache/tomcat/util/buf C2BConverter.java
Log:
Updated to use ByteChunk/CharChunk.
Revision Changes Path
1.2 +11 -9
jakarta-tomcat/src/share/org/apache/tomcat/util/buf/C2BConverter.java
Index: C2BConverter.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/C2BConverter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- C2BConverter.java 2001/05/21 03:46:29 1.1
+++ C2BConverter.java 2001/05/26 17:18:20 1.2
@@ -60,6 +60,8 @@
package org.apache.tomcat.util.buf;
+import org.apache.tomcat.util.buf.*;
+
import java.io.*;
/** Efficient conversion of character to bytes.
@@ -72,11 +74,11 @@
public final class C2BConverter {
private IntermediateOutputStream ios;
private WriteConvertor conv;
- private ByteBuffer bb;
+ private ByteChunk bb;
/** Create a converter, with bytes going to a byte buffer
*/
- public C2BConverter(ByteBuffer output, String encoding) throws IOException {
+ public C2BConverter(ByteChunk output, String encoding) throws IOException {
this.bb=output;
ios=new IntermediateOutputStream( output );
conv=new WriteConvertor( ios, encoding );
@@ -85,16 +87,16 @@
/** Create a converter
*/
public C2BConverter(String encoding) throws IOException {
- this( new ByteBuffer(), encoding );
+ this( new ByteChunk(1024), encoding );
}
- public ByteBuffer getByteBuffer() {
+ public ByteChunk getByteChunk() {
return bb;
}
- public void setByteBuffer(ByteBuffer bb) {
+ public void setByteChunk(ByteChunk bb) {
this.bb=bb;
- ios.setByteBuffer( bb );
+ ios.setByteChunk( bb );
}
/** Reset the internal state, empty the buffers.
@@ -209,10 +211,10 @@
not be called if recycling the converter and if data was not flushed.
*/
final class IntermediateOutputStream extends OutputStream {
- private ByteBuffer tbuff;
+ private ByteChunk tbuff;
private boolean enabled=true;
- public IntermediateOutputStream(ByteBuffer tbuff) {
+ public IntermediateOutputStream(ByteChunk tbuff) {
this.tbuff=tbuff;
}
@@ -239,7 +241,7 @@
// -------------------- Internal methods --------------------
- void setByteBuffer( ByteBuffer bb ) {
+ void setByteChunk( ByteChunk bb ) {
tbuff=bb;
}