Java Charset Create getEncodings()

Here you can find the source of getEncodings()

Description

get Encodings

License

Open Source License

Declaration

public static String[] getEncodings() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (C) 2005 - 2014 TIBCO Software Inc. All rights reserved.
 * http://www.jaspersoft.com./*from www  .  java  2  s. c  o  m*/
 * 
 * Unless you have purchased  a commercial license agreement from Jaspersoft,
 * the following license terms  apply:
 * 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/

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

public class Main {
    private static String[] encodings;

    public static String[] getEncodings() {
        if (encodings == null) {
            SortedMap<String, Charset> m = Charset.availableCharsets();
            Set<String> keySet = m.keySet();
            encodings = keySet.toArray(new String[keySet.size()]);
        }
        return encodings;
    }
}

Related

  1. getEncoding(byte[] htmlData)
  2. getEncoding(OutputStreamWriter inWriter)
  3. getEncoding(String text)
  4. getEncodingOfXml(File file)
  5. getEncodingOption(List options)
  6. getEncodings()