org.apache.struts2.util.tomcat.buf

## Class B2CConverter

- java.lang.Object
- - org.apache.struts2.util.tomcat.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

    All Methods Static Methods Instance Methods Concrete 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.
      Throws:
        `UnsupportedEncodingException`

    - #### 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`

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.