Java InputStream Read by Charset getInputCharset()

Here you can find the source of getInputCharset()

Description

get Input Charset

License

Open Source License

Declaration

public static Charset getInputCharset() 

Method Source Code

//package com.java2s;
/* //  www .  j  a  va 2  s .c o m
 * The MIT License
 *
 * Copyright 2014 Kamnev Georgiy (nt.gocha@gmail.com).
 *
 * ??????? ????????? ?????????, ????????????, ?????, ?????????? ????? ??????? ???????????? 
 * ????????????? ? ??????????????? ???????????? (? ?????????? ?????????? "??????????? ????????????"), 
 * ????????????? ??????????? ???????????? ??? ???????????, ???????? ?????????????? ????? ?? 
 * ??????????????, ???????????, ?????????, ???????????, ??????????, ?????????????????, ?????????????????? 
 * ?/??? ??????? ????? ???????????? ?????????????, ????? ??? ? ?????, ??????? ??????????????????? 
 * ?????? ??????????? ????????????, ??? ??????????? ?????????? ????????:
 *
 * ??????????????? ???????? ? ?????? ????????? ?????? ???? ???????? ?? ???? ????? 
 * ??? ???????? ?????? ??????? ???????????? ?????????????.
 *
 * ????????? ????????????? ???????????? ???????????????? ????? ?????, ??? ?????? ????? ???????????, 
 * ????? ????????????? ??? ?????????????????, ????????, ??? ??? ???????????????? ????????????? ?????????? ????????????, 
 * ???????????? ?? ??? ????????????? ??????????????? ? ??????????????? ?????. ??? ? ?????? ??????? ??????? 
 * ??? ?????????????????? ??? ?????? ????????????????? ?? ?????? ? ??????????? ???????, ??????? 
 * ??? ?????? ???????????? ?? ??????????? ?????????????, ????????? ??? ??????, ?????????? ??, ??????? 
 * ????????? ??? ???????????? ? ????????????? ????????????? ??? ???????????????? ?????????????? ???????????? 
 * ??? ?????? ?????????? ? ????????????? ?????????????.
 */

import java.nio.charset.Charset;

public class Main {
    private static Charset inputCharset = null;
    private static Charset defaultCharset = null;

    public static Charset getInputCharset() {
        if (inputCharset == null)
            inputCharset = getDefaultCharset();
        return inputCharset;
    }

    public static Charset getDefaultCharset() {
        if (defaultCharset == null)
            defaultCharset = Charset.defaultCharset();
        return defaultCharset;
    }
}

Related

  1. createZipInputStream(InputStream inStream, Charset charset)
  2. forceEncoding(String inputString, String targetCharset)
  3. fromUnicode(String charset, String input)
  4. getContentFromInputStream(InputStream in, String charset)
  5. getHeaderLen(FileInputStream in, Charset encoding)
  6. getStreamAsString(InputStream source, Charset charset)
  7. getText(InputStream stream, Charset charset)
  8. input2String(InputStream input, Charset encoding)
  9. inputStreamAsString(InputStream stream, Charset cs)