Java CharsetDecoder .averageCharsPerByte ()

Syntax

CharsetDecoder.averageCharsPerByte() has the following syntax.

public final float averageCharsPerByte()

Example

In the following code shows how to use CharsetDecoder.averageCharsPerByte() method.


//  w  w w  .  jav a2s .c  om
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;

public class Main {
  public static void main(String[] argv) throws Exception {
    Charset charset = Charset.forName("ISO-8859-1");
    CharsetDecoder decoder = charset.newDecoder();

    System.out.println(decoder.averageCharsPerByte());
  }
}




















Home »
  Java Tutorial »
    java.nio.charset »




Charset
CharsetDecoder
CharsetEncoder
StandardCharsets