Java Charset Create getCharset(String encoding)

Here you can find the source of getCharset(String encoding)

Description

get Charset

License

Apache License

Declaration

static final Charset getCharset(String encoding) 

Method Source Code

//package com.java2s;
// Apache License

import java.nio.charset.Charset;

import java.util.HashMap;

public class Main {
    private static final HashMap charsets = new HashMap();

    static final Charset getCharset(String encoding) {
        Charset charset = (Charset) charsets.get(encoding);
        if (charset == null) {
            charset = Charset.forName(encoding);
            charsets.put(encoding, charset);
        }//from w w w . j a v a  2 s.c o  m
        return charset;
    }
}

Related

  1. getCharset(String charsetName)
  2. getCharset(String charsetName)
  3. getCharset(String contentType)
  4. getCharset(String enc)
  5. getCharset(String encoding)
  6. getCharset(String name)
  7. getCharsetForSortOrder(final int sortOrder)
  8. getCharsetFromContent(URL url)
  9. getCharsetFromContentType(String contentType)