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

public Class B2CConverter

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

NIO based character decoder.

Field Summary

Modifier and TypeField and Description
private ByteBuffer
private CharBuffer
private static final CharsetCache
private final CharsetDecoder
protected static final int
private final ByteBuffer
leftovers

Leftover buffer used for incomplete characters.

private static final Log
private static final StringManager

Constructor Summary

AccessConstructor and Description
public
public
B2CConverter(Charset charset, boolean replaceOnError)

Method Summary

Modifier and TypeMethod and Description
public void
convert(ByteChunk
byte input
bc
,
CharChunk
char output
cc
,
boolean
Is this all of the available data
endOfInput
)

Convert the given bytes to characters.

public void
convert(ByteBuffer
byte input
bc
,
CharBuffer
char output
cc
,
ByteChunk.ByteInputChannel
byte input channel
ic
,
boolean
Is this all of the available data
endOfInput
)

Convert the given bytes to characters.

public static Charset

Returns:

The Charset corresponding to the requested encoding
getCharset
(String
The name of the encoding for the required charset
enc
)

Obtain the Charset for the given encoding

public Charset
public void
recycle()

Reset the decoder state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bbback to summary
private ByteBuffer bb
cbback to summary
private CharBuffer cb
charsetCacheback to summary
private static final CharsetCache charsetCache
decoderback to summary
private final CharsetDecoder decoder
LEFTOVER_SIZEback to summary
protected static final int LEFTOVER_SIZE
leftoversback to summary
private final ByteBuffer leftovers

Leftover buffer used for incomplete characters.

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

Constructor Detail

B2CConverterback to summary
public B2CConverter(Charset charset)
B2CConverterback to summary
public B2CConverter(Charset charset, boolean replaceOnError)

Method Detail

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

Convert the given bytes to characters.

Parameters
bc:ByteChunk

byte input

cc:CharChunk

char output

endOfInput:boolean

Is this all of the available data

Exceptions
IOException:
If the conversion can not be completed
convertback to summary
public void convert(ByteBuffer bc, CharBuffer cc, ByteChunk.ByteInputChannel ic, boolean endOfInput) throws IOException

Convert the given bytes to characters.

Parameters
bc:ByteBuffer

byte input

cc:CharBuffer

char output

ic:ByteChunk.ByteInputChannel

byte input channel

endOfInput:boolean

Is this all of the available data

Exceptions
IOException:
If the conversion can not be completed
getCharsetback to summary
public static Charset getCharset(String enc) throws UnsupportedEncodingException

Obtain the Charset for the given encoding

Parameters
enc:String

The name of the encoding for the required charset

Returns:Charset

The Charset corresponding to the requested encoding

Exceptions
UnsupportedEncodingException:
If the requested Charset is not available
getCharsetback to summary
public Charset getCharset()
recycleback to summary
public void recycle()

Reset the decoder state.