org.apache.tomcat.util.buf
Class C2BConverter
java.lang.Object
org.apache.tomcat.util.buf.C2BConverter
public final class C2BConverter
extends java.lang.Object
Efficient conversion of character to bytes.
This uses the standard JDK mechansim - a writer - but provides mechanisms
to recycle all the objects that are used. It is compatible with JDK1.1 and up,
( nio is better, but it's not available even in 1.2 or 1.3 )
C2BConverter
public C2BConverter(String encoding)
throws IOException
Create a converter
C2BConverter
public C2BConverter(ByteChunk output,
String encoding)
throws IOException
Create a converter, with bytes going to a byte buffer
convert
public final void convert(String s)
throws IOException
Generate the bytes using the specified encoding
convert
public final void convert(c[] ,
int off,
int len)
throws IOException
Generate the bytes using the specified encoding
convert
public final void convert(char c)
throws IOException
Generate the bytes using the specified encoding
convert
public final void convert(MessageBytes mb)
throws IOException
Convert a message bytes chars to bytes
flushBuffer
public final void flushBuffer()
throws IOException
Flush any internal buffers into the ByteOutput or the internal
byte[]
getEncoding
public String getEncoding()
recycle
public final void recycle()
Reset the internal state, empty the buffers.
The encoding remain in effect, the internal buffers remain allocated.
setByteChunk
public void setByteChunk(ByteChunk bb)
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.