Top Description Fields Constructors Methods
io.netty5.util

public final Class CharsetUtil

extends Object
Class Inheritance
Imports
io.netty5.util.concurrent.FastThreadLocal, java.nio.charset.Charset, .CharsetDecoder, .CharsetEncoder, .CodingErrorAction, java.util.IdentityHashMap, .Map

A utility class that provides various common operations and constants related with Charset and its relevant classes.

Field Summary

Modifier and TypeField and Description
private static final FastThreadLocal<Map<Charset, CharsetDecoder>>
private static final FastThreadLocal<Map<Charset, CharsetEncoder>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CharsetDecoder

Returns:

The decoder for the specified charset
decoder
(Charset
The specified charset
charset
,
CodingErrorAction
The decoder's action for malformed-input errors
malformedInputAction
,
CodingErrorAction
The decoder's action for unmappable-character errors
unmappableCharacterAction
)

Returns a new CharsetDecoder for the Charset with specified error actions.

public static CharsetDecoder

Returns:

The decoder for the specified charset
decoder
(Charset
The specified charset
charset
,
CodingErrorAction
The decoder's action for malformed-input and unmappable-character errors
codingErrorAction
)

Returns a new CharsetDecoder for the Charset with the specified error action.

public static CharsetDecoder

Returns:

The decoder for the specified charset
decoder
(Charset
The specified charset
charset
)

Returns a cached thread-local CharsetDecoder for the specified Charset.

public static CharsetEncoder

Returns:

The encoder for the specified charset
encoder
(Charset
The specified charset
charset
,
CodingErrorAction
The encoder's action for malformed-input errors
malformedInputAction
,
CodingErrorAction
The encoder's action for unmappable-character errors
unmappableCharacterAction
)

Returns a new CharsetEncoder for the Charset with specified error actions.

public static CharsetEncoder

Returns:

The encoder for the specified charset
encoder
(Charset
The specified charset
charset
,
CodingErrorAction
The encoder's action for malformed-input and unmappable-character errors
codingErrorAction
)

Returns a new CharsetEncoder for the Charset with the specified error action.

public static CharsetEncoder

Returns:

The encoder for the specified charset
encoder
(Charset
The specified charset
charset
)

Returns a cached thread-local CharsetEncoder for the specified Charset.

public static CharsetDecoder
getDecoder(Charset charset)

Deprecated Use decoder(Charset).
public static CharsetEncoder
getEncoder(Charset charset)

Deprecated Use encoder(Charset).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DECODER_CACHEback to summary
private static final FastThreadLocal<Map<Charset, CharsetDecoder>> DECODER_CACHE
ENCODER_CACHEback to summary
private static final FastThreadLocal<Map<Charset, CharsetEncoder>> ENCODER_CACHE

Constructor Detail

CharsetUtilback to summary
private CharsetUtil()

Method Detail

decoderback to summary
public static CharsetDecoder decoder(Charset charset, CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction)

Returns a new CharsetDecoder for the Charset with specified error actions.

Parameters
charset:Charset

The specified charset

malformedInputAction:CodingErrorAction

The decoder's action for malformed-input errors

unmappableCharacterAction:CodingErrorAction

The decoder's action for unmappable-character errors

Returns:CharsetDecoder

The decoder for the specified charset

decoderback to summary
public static CharsetDecoder decoder(Charset charset, CodingErrorAction codingErrorAction)

Returns a new CharsetDecoder for the Charset with the specified error action.

Parameters
charset:Charset

The specified charset

codingErrorAction:CodingErrorAction

The decoder's action for malformed-input and unmappable-character errors

Returns:CharsetDecoder

The decoder for the specified charset

decoderback to summary
public static CharsetDecoder decoder(Charset charset)

Returns a cached thread-local CharsetDecoder for the specified Charset.

Parameters
charset:Charset

The specified charset

Returns:CharsetDecoder

The decoder for the specified charset

encoderback to summary
public static CharsetEncoder encoder(Charset charset, CodingErrorAction malformedInputAction, CodingErrorAction unmappableCharacterAction)

Returns a new CharsetEncoder for the Charset with specified error actions.

Parameters
charset:Charset

The specified charset

malformedInputAction:CodingErrorAction

The encoder's action for malformed-input errors

unmappableCharacterAction:CodingErrorAction

The encoder's action for unmappable-character errors

Returns:CharsetEncoder

The encoder for the specified charset

encoderback to summary
public static CharsetEncoder encoder(Charset charset, CodingErrorAction codingErrorAction)

Returns a new CharsetEncoder for the Charset with the specified error action.

Parameters
charset:Charset

The specified charset

codingErrorAction:CodingErrorAction

The encoder's action for malformed-input and unmappable-character errors

Returns:CharsetEncoder

The encoder for the specified charset

encoderback to summary
public static CharsetEncoder encoder(Charset charset)

Returns a cached thread-local CharsetEncoder for the specified Charset.

Parameters
charset:Charset

The specified charset

Returns:CharsetEncoder

The encoder for the specified charset

getDecoderback to summary
public static CharsetDecoder getDecoder(Charset charset)

Deprecated

Use decoder(Charset).

Annotations
@Deprecated
getEncoderback to summary
public static CharsetEncoder getEncoder(Charset charset)

Deprecated

Use encoder(Charset).

Annotations
@Deprecated