Class B2CConverter
java.lang.Object
org.apache.tomcat.util.buf.B2CConverter
NIO based character decoder.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intMaximum size for leftover bytes used for incomplete characters during decoding. -
Constructor Summary
ConstructorsConstructorDescriptionB2CConverter(Charset charset) Constructs a B2CConverter for the given charset, reporting errors on malformed input.B2CConverter(Charset charset, boolean replaceOnError) Deprecated.Unused. -
Method Summary
Modifier and TypeMethodDescriptionvoidconvert(ByteBuffer bc, CharBuffer cc, ByteChunk.ByteInputChannel ic, boolean endOfInput) Convert the given bytes to characters.voidConvert the given bytes to characters.Returns the charset used by this converter.static CharsetgetCharset(String enc) Obtain the Charset for the given encodingvoidrecycle()Reset the decoder state.
-
Field Details
-
LEFTOVER_SIZE
protected static final int LEFTOVER_SIZEMaximum size for leftover bytes used for incomplete characters during decoding.- See Also:
-
-
Constructor Details
-
B2CConverter
Constructs a B2CConverter for the given charset, reporting errors on malformed input.- Parameters:
charset- the charset to use for decoding
-
B2CConverter
Deprecated.Unused. Will be removed in Tomcat 12 onwards. UseB2CConverter(Charset)Constructs a B2CConverter for the given charset.- Parameters:
charset- the charset to use for decodingreplaceOnError- iftrue, replace malformed/unmappable input; otherwise report errors
-
-
Method Details
-
getCharset
Obtain the Charset for the given encoding- Parameters:
enc- The name of the encoding for the required charset- Returns:
- The Charset corresponding to the requested encoding
- Throws:
UnsupportedEncodingException- If the requested Charset is not available
-
recycle
public void recycle()Reset the decoder state. -
convert
Convert the given bytes to characters.- Parameters:
bc- byte inputcc- char outputendOfInput- Is this all of the available data- Throws:
IOException- If the conversion can not be completed
-
convert
public void convert(ByteBuffer bc, CharBuffer cc, ByteChunk.ByteInputChannel ic, boolean endOfInput) throws IOException Convert the given bytes to characters.- Parameters:
bc- byte inputcc- char outputic- byte input channelendOfInput- Is this all of the available data- Throws:
IOException- If the conversion can not be completed
-
getCharset
-