Java CharsetEncoder .maxBytesPerChar ()
Syntax
CharsetEncoder.maxBytesPerChar() has the following syntax.
public final float maxBytesPerChar()
Example
In the following code shows how to use CharsetEncoder.maxBytesPerChar() method.
// w w w .java 2 s. c om
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
public class Main {
public static void main(String[] args) throws Exception{
CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
System.out.println(encoder.maxBytesPerChar());
}
}