Here you can find the source of newString(byte[] bytes, Charset charset)
private static String newString(byte[] bytes, Charset charset)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; public class Main { private static String newString(byte[] bytes, Charset charset) { return bytes == null ? null : new String(bytes, charset); }/* w ww. j av a 2 s .co m*/ public static String newString(byte[] bytes, String charsetName) { if (bytes == null) { return null; } else { try { return new String(bytes, charsetName); } catch (UnsupportedEncodingException var3) { throw newIllegalStateException(charsetName, var3); } } } private static IllegalStateException newIllegalStateException(String charsetName, UnsupportedEncodingException e) { return new IllegalStateException(charsetName + ": " + e); } }