org.apache.tomcat.util.buf

## Class C2BConverter

- java.lang.Object
- - org.apache.tomcat.util.buf.C2BConverter

    public final class C2BConverter
    extends Object

NIO based character encoder.

### Field Summary

Fields
`protected ByteBuffer` `bb`
`protected CharBuffer` `cb`
`protected CharsetEncoder` `encoder`
`protected CharBuffer` `leftovers` Leftover buffer used for multi-characters characters.

### Constructor Summary

Constructors
Constructor and Description
`C2BConverter(String encoding)`

### Method Summary

Methods
`void` `convert(CharChunk cc, ByteChunk bc)` Convert the given characters to bytes.
`boolean` `isUndeflow()`
`void` `recycle()` Reset the encoder state.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### encoder

    protected CharsetEncoder encoder

#### bb

    protected ByteBuffer bb

#### cb

    protected CharBuffer cb

#### leftovers

    protected CharBuffer leftovers

Leftover buffer used for multi-characters characters.

### Constructor Detail

#### C2BConverter

    public C2BConverter(String encoding)
                 throws IOException

Throws:
  `IOException`

### Method Detail

#### recycle

    public void recycle()

Reset the encoder state.

#### isUndeflow

    public boolean isUndeflow()

#### convert

    public void convert(CharChunk cc,
               ByteChunk bc)
                 throws IOException

Convert the given characters to bytes.

Parameters:
  `cc` - char input
  `bc` - byte output
Throws:
  `IOException`