public static Charset toCharset(final Charset charset) {
        return charset == null ? Charset.defaultCharset() : charset;
    }
Returns the given Charset or the default Charset if the given Charset is null.

@param charset
           A charset or null.
@return the given Charset or the default Charset if the given Charset is null
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/Charsets.java