Top Description Fields Constructors Methods
org.apache.tomcat.util.buf

public final Class C2BConverter

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetEncoder, .CoderResult, .CodingErrorAction, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.ExceptionUtils, org.apache.tomcat.util.res.StringManager

NIO based character encoder.

Field Summary

Modifier and TypeField and Description
private ByteBuffer
private CharBuffer
private final CharsetEncoder
private final CharBuffer
leftovers

Leftover buffer used for multi-characters characters.

private static final Log
private static final StringManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
convert(CharChunk
char input
cc
,
ByteChunk
byte output
bc
)

Convert the given characters to bytes.

public void
convert(CharBuffer
char input
cc
,
ByteBuffer
byte output
bc
)

Convert the given characters to bytes.

public Charset
public boolean
public void
recycle()

Reset the encoder state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bbback to summary
private ByteBuffer bb
cbback to summary
private CharBuffer cb
encoderback to summary
private final CharsetEncoder encoder
leftoversback to summary
private final CharBuffer leftovers

Leftover buffer used for multi-characters characters.

logback to summary
private static final Log log
smback to summary
private static final StringManager sm

Constructor Detail

C2BConverterback to summary
public C2BConverter(Charset charset)

Method Detail

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

Convert the given characters to bytes.

Parameters
cc:CharChunk

char input

bc:ByteChunk

byte output

Exceptions
IOException:
An encoding error occurred
convertback to summary
public void convert(CharBuffer cc, ByteBuffer bc) throws IOException

Convert the given characters to bytes.

Parameters
cc:CharBuffer

char input

bc:ByteBuffer

byte output

Exceptions
IOException:
An encoding error occurred
getCharsetback to summary
public Charset getCharset()
isUndeflowback to summary
public boolean isUndeflow()
recycleback to summary
public void recycle()

Reset the encoder state.