Java CharsetDecoder .detectedCharset ()
Syntax
CharsetDecoder.detectedCharset() has the following syntax.
public Charset detectedCharset()
Example
In the following code shows how to use CharsetDecoder.detectedCharset() method.
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
/*from www . j av a2s.c om*/
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.detectedCharset());
}
}