Here you can find the source of parseBytes(byte[] encoded, Charset charset)
public static String parseBytes(byte[] encoded, Charset charset) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; public class Main { public static String parseBytes(byte[] encoded) throws UnsupportedEncodingException { assert encoded != null : "encoded byte array should not be null"; String decoded = parseBytes(encoded, StandardCharsets.UTF_8); return decoded; }//from w w w . ja va 2 s. c om public static String parseBytes(byte[] encoded, Charset charset) throws UnsupportedEncodingException { String decoded = new String(encoded, charset.name()); return decoded; } }