Class CharsetUtil
java.lang.Object
io.netty.util.CharsetUtil
public final class CharsetUtil
extends java.lang.Object
A utility class that provides various common operations and constants
related with
Charset and its relevant classes.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final java.nio.charset.Charset[]static final java.nio.charset.CharsetISO Latin Alphabet No.static final java.nio.charset.Charset7-bit ASCII, as known as ISO646-US or the Basic Latin block of the Unicode character setstatic final java.nio.charset.Charset16-bit UTF (UCS Transformation Format) whose byte order is identified by an optional byte-order markstatic final java.nio.charset.Charset16-bit UTF (UCS Transformation Format) whose byte order is big-endianstatic final java.nio.charset.Charset16-bit UTF (UCS Transformation Format) whose byte order is little-endianstatic final java.nio.charset.Charset8-bit UTF (UCS Transformation Format) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic java.nio.charset.CharsetDecoderdecoder(java.nio.charset.Charset charset) Returns a cached thread-localCharsetDecoderfor the specifiedCharset.static java.nio.charset.CharsetDecoderdecoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction codingErrorAction) Returns a newCharsetDecoderfor theCharsetwith the specified error action.static java.nio.charset.CharsetDecoderdecoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction malformedInputAction, java.nio.charset.CodingErrorAction unmappableCharacterAction) Returns a newCharsetDecoderfor theCharsetwith specified error actions.static java.nio.charset.CharsetEncoderencoder(java.nio.charset.Charset charset) Returns a cached thread-localCharsetEncoderfor the specifiedCharset.static java.nio.charset.CharsetEncoderencoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction codingErrorAction) Returns a newCharsetEncoderfor theCharsetwith the specified error action.static java.nio.charset.CharsetEncoderencoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction malformedInputAction, java.nio.charset.CodingErrorAction unmappableCharacterAction) Returns a newCharsetEncoderfor theCharsetwith specified error actions.static java.nio.charset.CharsetDecodergetDecoder(java.nio.charset.Charset charset) Deprecated.static java.nio.charset.CharsetEncodergetEncoder(java.nio.charset.Charset charset) Deprecated.Useencoder(Charset).static java.nio.charset.Charset[]values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
UTF_16
public static final java.nio.charset.Charset UTF_1616-bit UTF (UCS Transformation Format) whose byte order is identified by an optional byte-order mark -
UTF_16BE
public static final java.nio.charset.Charset UTF_16BE16-bit UTF (UCS Transformation Format) whose byte order is big-endian -
UTF_16LE
public static final java.nio.charset.Charset UTF_16LE16-bit UTF (UCS Transformation Format) whose byte order is little-endian -
UTF_8
public static final java.nio.charset.Charset UTF_88-bit UTF (UCS Transformation Format) -
ISO_8859_1
public static final java.nio.charset.Charset ISO_8859_1ISO Latin Alphabet No. 1, as known as ISO-LATIN-1 -
US_ASCII
public static final java.nio.charset.Charset US_ASCII7-bit ASCII, as known as ISO646-US or the Basic Latin block of the Unicode character set -
CHARSETS
private static final java.nio.charset.Charset[] CHARSETS
-
-
Constructor Details
-
CharsetUtil
private CharsetUtil()
-
-
Method Details
-
values
public static java.nio.charset.Charset[] values() -
getEncoder
@Deprecated public static java.nio.charset.CharsetEncoder getEncoder(java.nio.charset.Charset charset) Deprecated.Useencoder(Charset). -
encoder
public static java.nio.charset.CharsetEncoder encoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction malformedInputAction, java.nio.charset.CodingErrorAction unmappableCharacterAction) Returns a newCharsetEncoderfor theCharsetwith specified error actions.- Parameters:
charset- The specified charsetmalformedInputAction- The encoder's action for malformed-input errorsunmappableCharacterAction- The encoder's action for unmappable-character errors- Returns:
- The encoder for the specified
charset
-
encoder
public static java.nio.charset.CharsetEncoder encoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction codingErrorAction) Returns a newCharsetEncoderfor theCharsetwith the specified error action.- Parameters:
charset- The specified charsetcodingErrorAction- The encoder's action for malformed-input and unmappable-character errors- Returns:
- The encoder for the specified
charset
-
encoder
public static java.nio.charset.CharsetEncoder encoder(java.nio.charset.Charset charset) Returns a cached thread-localCharsetEncoderfor the specifiedCharset.- Parameters:
charset- The specified charset- Returns:
- The encoder for the specified
charset
-
getDecoder
@Deprecated public static java.nio.charset.CharsetDecoder getDecoder(java.nio.charset.Charset charset) Deprecated.Usedecoder(Charset). -
decoder
public static java.nio.charset.CharsetDecoder decoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction malformedInputAction, java.nio.charset.CodingErrorAction unmappableCharacterAction) Returns a newCharsetDecoderfor theCharsetwith specified error actions.- Parameters:
charset- The specified charsetmalformedInputAction- The decoder's action for malformed-input errorsunmappableCharacterAction- The decoder's action for unmappable-character errors- Returns:
- The decoder for the specified
charset
-
decoder
public static java.nio.charset.CharsetDecoder decoder(java.nio.charset.Charset charset, java.nio.charset.CodingErrorAction codingErrorAction) Returns a newCharsetDecoderfor theCharsetwith the specified error action.- Parameters:
charset- The specified charsetcodingErrorAction- The decoder's action for malformed-input and unmappable-character errors- Returns:
- The decoder for the specified
charset
-
decoder
public static java.nio.charset.CharsetDecoder decoder(java.nio.charset.Charset charset) Returns a cached thread-localCharsetDecoderfor the specifiedCharset.- Parameters:
charset- The specified charset- Returns:
- The decoder for the specified
charset
-
decoder(Charset).