Apache Tomcat 7.0.33

org.apache.tomcat.util.buf
Class B2CConverter

java.lang.Object
  extended by org.apache.tomcat.util.buf.B2CConverter

public class B2CConverter
extends java.lang.Object

Efficient conversion of bytes to character . This uses the standard JDK mechanism - a reader - 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 ) Not used in the current code, the performance gain is not very big in the current case ( since String is created anyway ), but it will be used in a later version or after the remaining optimizations.


Field Summary
static java.nio.charset.Charset ISO_8859_1
           
static java.nio.charset.Charset UTF_8
           
 
Constructor Summary
protected B2CConverter()
          Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
  B2CConverter(java.lang.String encoding)
          Create a converter, with bytes going to a byte buffer
 
Method Summary
 void convert(ByteChunk bb, CharChunk cb, int limit)
          Convert a buffer of bytes into a chars.
static java.nio.charset.Charset getCharset(java.lang.String enc)
           
 void recycle()
          Reset the internal state, empty the buffers.
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO_8859_1

public static final java.nio.charset.Charset ISO_8859_1

UTF_8

public static final java.nio.charset.Charset UTF_8
Constructor Detail

B2CConverter

@Deprecated
protected B2CConverter()
Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.


B2CConverter

public B2CConverter(java.lang.String encoding)
             throws java.io.IOException
Create a converter, with bytes going to a byte buffer

Throws:
java.io.IOException
Method Detail

getCharset

public static java.nio.charset.Charset getCharset(java.lang.String enc)
                                           throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

recycle

public void recycle()
Reset the internal state, empty the buffers. The encoding remain in effect, the internal buffers remain allocated.


convert

public void convert(ByteChunk bb,
                    CharChunk cb,
                    int limit)
             throws java.io.IOException
Convert a buffer of bytes into a chars.

Parameters:
bb - Input byte buffer
cb - Output char buffer
limit - Number of bytes to convert
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Throws:
java.io.IOException

Apache Tomcat 7.0.33

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.