B2CConverter (Apache Tomcat 7.0.104 API Documentation)

org.apache.tomcat.util.buf

## Class B2CConverter

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

-     public class B2CConverter
      extends Object

  NIO based character decoder.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Charset` | `ISO_8859_1`
    `protected static int` | `LEFTOVER_SIZE`
    `static Charset` | `UTF_8`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `B2CConverter(String encoding)`
    `B2CConverter(String encoding, boolean replaceOnError)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `convert(ByteChunk bc, CharChunk cc, boolean endOfInput)` Convert the given bytes to characters.
    `static Charset` | `getCharset(String enc)`
    `static Charset` | `getCharsetLower(String lowerCaseEnc)` Only to be used when it is known that the encoding name is in lower case.
    `void` | `recycle()` Reset the decoder state.

    - ### 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 Charset ISO_8859_1

    - #### UTF_8

          public static final Charset UTF_8

    - #### LEFTOVER_SIZE

          protected static final int LEFTOVER_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### B2CConverter

          public B2CConverter(String encoding)
                       throws IOException

      Throws:
        `IOException`

    - #### B2CConverter

          public B2CConverter(String encoding,
                      boolean replaceOnError)
                       throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getCharset

          public static Charset getCharset(String enc)
                                    throws UnsupportedEncodingException

      Throws:
        `UnsupportedEncodingException`

    - #### getCharsetLower

          public static Charset getCharsetLower(String lowerCaseEnc)
                                         throws UnsupportedEncodingException

      Only to be used when it is known that the encoding name is in lower case.
      Parameters:
        `lowerCaseEnc` - The name of the encoding for the required charset in lower case
      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

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

      Convert the given bytes to characters.
      Parameters:
        `bc` - byte input
        `cc` - char output
        `endOfInput` - Is this all of the available data
      Throws:
        `IOException` - If the conversion can not be completed

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