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.

Similar Reads

What is a CharsetEncoder?

The ‘CharsetEncoder’ class is imported from ‘java.nio.charset’ package....

Constructors of CharsetEncoder

Constructor associated with CharsetEncoder and its description....

Methods of CharsetEncoder

Table of the methods associated with CharsetEncoder and its description....

Examples of CharEncoder Class

Example 1: Basic use of CharsetEncoder...

How to Optimize the Encoding?

...

Contact Us