Charset: name() : Charset « java.nio.charset « Java by API






Charset: name()

 
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;

public class Main {

  public static void main(String[] args) {
    Map charsets = Charset.availableCharsets();
    Iterator iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
      Charset cs = (Charset) iterator.next();
      System.out.print(cs.displayName());
      if (cs.isRegistered()) {
        System.out.print(" (registered): ");
      } else {
        System.out.print(" (unregistered): ");
      }
      System.out.print(cs.name());
      Iterator names = cs.aliases().iterator();
      while (names.hasNext()) {
        System.out.print(", ");
        System.out.print(names.next());
      }
      System.out.println();
    }
  }
}

   
  








Related examples in the same category

1.Charset: aliases()
2.Charset: availableCharsets()
3.Charset: defaultCharset()
4.Charset: displayName()
5.Charset: forName(String charsetName)
6.Charset: isRegistered()
7.Charset: newDecoder()
8.Charset: newEncoder()