Here you can find the source of charsetForNameOrDefault(String encoding)
public static Charset charsetForNameOrDefault(String encoding)
//package com.java2s; /* Copyright ? 2015 Gerald Rosenberg. * Use of this source code is governed by a BSD-style * license that can be found in the License.md file. *///from ww w .j av a 2s . c om import java.nio.charset.Charset; public class Main { public static Charset charsetForNameOrDefault(String encoding) { Charset charset = (encoding == null) ? Charset.defaultCharset() : Charset.forName(encoding); return charset; } }