Constructors of CharsetEncoder
Constructor associated with CharsetEncoder and its description.
Constructor |
Modifier |
Description |
---|---|---|
CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar) |
protected |
A new encoder for a given Charset is initialized with the maximum and average bytes per character specified by the CharsetEncoder constructor. |
CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar, byte[] replacement) |
protected |
A new encoder for a given Charset is initialized by the CharsetEncoder constructor with an estimated average and maximum number of bytes per character as well as a unique alternative byte sequence for characters that cannot be mapped. |
java.nio.charset.CharsetEncoder Class in Java
For the purpose of character encoding and decoding, java offers a number of classes in the ‘java.nio.charset’ package. The ‘CharsetEncoder’ class of this package performs the important task of encoding. In this article, let us understand this class, its syntax, different methods, and some examples of error handling and optimization techniques.