Home / Class/ CharsetUtil Class — netty Architecture

CharsetUtil Class — netty Architecture

Architecture documentation for the CharsetUtil class in CharsetUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  345373ad_51f3_adea_7ea5_8c3127ade75d["CharsetUtil"]
  ca975390_d82b_0690_d282_8b295b09a006["CharsetUtil.java"]
  345373ad_51f3_adea_7ea5_8c3127ade75d -->|defined in| ca975390_d82b_0690_d282_8b295b09a006
  074b463a_d822_a5e3_3f9e_791ce535c0a1["values()"]
  345373ad_51f3_adea_7ea5_8c3127ade75d -->|method| 074b463a_d822_a5e3_3f9e_791ce535c0a1
  7d8a20b7_aebd_5ca7_51de_e04109df6a63["CharsetEncoder()"]
  345373ad_51f3_adea_7ea5_8c3127ade75d -->|method| 7d8a20b7_aebd_5ca7_51de_e04109df6a63
  65c717fe_86ba_6ee7_a087_a1f8442908b6["CharsetDecoder()"]
  345373ad_51f3_adea_7ea5_8c3127ade75d -->|method| 65c717fe_86ba_6ee7_a087_a1f8442908b6
  5d257837_a055_09f5_326d_ff0e04962554["CharsetUtil()"]
  345373ad_51f3_adea_7ea5_8c3127ade75d -->|method| 5d257837_a055_09f5_326d_ff0e04962554

Relationship Graph

Source Code

common/src/main/java/io/netty/util/CharsetUtil.java lines 32–186

public final class CharsetUtil {

    /**
     * 16-bit UTF (UCS Transformation Format) whose byte order is identified by
     * an optional byte-order mark
     */
    public static final Charset UTF_16 = StandardCharsets.UTF_16;

    /**
     * 16-bit UTF (UCS Transformation Format) whose byte order is big-endian
     */
    public static final Charset UTF_16BE = StandardCharsets.UTF_16BE;

    /**
     * 16-bit UTF (UCS Transformation Format) whose byte order is little-endian
     */
    public static final Charset UTF_16LE = StandardCharsets.UTF_16LE;

    /**
     * 8-bit UTF (UCS Transformation Format)
     */
    public static final Charset UTF_8 = StandardCharsets.UTF_8;

    /**
     * ISO Latin Alphabet No. 1, as known as <tt>ISO-LATIN-1</tt>
     */
    public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;

    /**
     * 7-bit ASCII, as known as ISO646-US or the Basic Latin block of the
     * Unicode character set
     */
    public static final Charset US_ASCII = StandardCharsets.US_ASCII;

    private static final Charset[] CHARSETS = new Charset[]
            { UTF_16, UTF_16BE, UTF_16LE, UTF_8, ISO_8859_1, US_ASCII };

    public static Charset[] values() {
        return CHARSETS;
    }

    /**
     * @deprecated Use {@link #encoder(Charset)}.
     */
    @Deprecated
    public static CharsetEncoder getEncoder(Charset charset) {
        return encoder(charset);
    }

    /**
     * Returns a new {@link CharsetEncoder} for the {@link Charset} with specified error actions.
     *
     * @param charset The specified charset
     * @param malformedInputAction The encoder's action for malformed-input errors
     * @param unmappableCharacterAction The encoder's action for unmappable-character errors
     * @return The encoder for the specified {@code charset}
     */
    public static CharsetEncoder encoder(Charset charset, CodingErrorAction malformedInputAction,
                                         CodingErrorAction unmappableCharacterAction) {
        checkNotNull(charset, "charset");
        CharsetEncoder e = charset.newEncoder();
        e.onMalformedInput(malformedInputAction).onUnmappableCharacter(unmappableCharacterAction);
        return e;
    }

    /**
     * Returns a new {@link CharsetEncoder} for the {@link Charset} with the specified error action.
     *
     * @param charset The specified charset
     * @param codingErrorAction The encoder's action for malformed-input and unmappable-character errors
     * @return The encoder for the specified {@code charset}
     */
    public static CharsetEncoder encoder(Charset charset, CodingErrorAction codingErrorAction) {
        return encoder(charset, codingErrorAction, codingErrorAction);
    }

    /**
     * Returns a cached thread-local {@link CharsetEncoder} for the specified {@link Charset}.
     *
     * @param charset The specified charset
     * @return The encoder for the specified {@code charset}

Frequently Asked Questions

What is the CharsetUtil class?
CharsetUtil is a class in the netty codebase, defined in common/src/main/java/io/netty/util/CharsetUtil.java.
Where is CharsetUtil defined?
CharsetUtil is defined in common/src/main/java/io/netty/util/CharsetUtil.java at line 32.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free