private static Charset toCharset(String csn) throws UnsupportedEncodingException {
  requireNonNull(csn,"charsetName");
  try {
    return Charset.forName(csn);
  }
 catch (  IllegalCharsetNameException|UnsupportedCharsetException unused) {
    throw new UnsupportedEncodingException(csn);
  }
}

private static Charset toCharset ( String csn ) throws UnsupportedEncodingException { requireNonNull ( csn , "charsetName" ) ; try { return Charset . forName ( csn ) ; } catch ( IllegalCharsetNameException | UnsupportedCharsetException unused ) { throw new UnsupportedEncodingException ( csn ) ; } }
returns a charset object for the given charset name .
