Java IO Tutorial - Java CharsetDecoder .maxCharsPerByte ()








Syntax

CharsetDecoder.maxCharsPerByte() has the following syntax.

public final float maxCharsPerByte()

Example

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

import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
/* w  w  w . j  a  va 2s  .  co m*/
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.maxCharsPerByte());
  }
}

The code above generates the following result.