Java IO Tutorial - Java Charset.aliases()








Syntax

Charset.aliases() has the following syntax.

public final Set<String> aliases()

Example

In the following code shows how to use Charset.aliases() method.

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;
// w  ww .j a v  a 2s .c  o m
public class Main {

  public static void main(String[] args) {
    Map<String, Charset> charsets = Charset.availableCharsets();
    Iterator<Charset> iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
      Charset cs = (Charset) iterator.next();
      System.out.println(cs.aliases());
    }
  }
}

The code above generates the following result.