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






Charset: availableCharsets()

 
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedMap;

public class Main {
  static public void main(String args[]) throws Exception {
    SortedMap charsets = Charset.availableCharsets();
    Set names = charsets.keySet();
    for (Iterator e = names.iterator(); e.hasNext();) {
      String name = (String) e.next();
      Charset charset = (Charset) charsets.get(name);
      System.out.println(charset);
      Set aliases = charset.aliases();
      for (Iterator ee = aliases.iterator(); ee.hasNext();) {
        System.out.println("    " + ee.next());
      }
    }
  }
}

   
  








Related examples in the same category

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