Java IO Tutorial - Java CharsetDecoder .isCharsetDetected ()








Syntax

CharsetDecoder.isCharsetDetected() has the following syntax.

public boolean isCharsetDetected()

Example

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

/*from w  w w  .  j a va  2  s .  c  o  m*/
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.isCharsetDetected());
  }
}