Here you can find the source of buffer2String(ByteBuffer buff, String charsetName)
public static String buffer2String(ByteBuffer buff, String charsetName)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.charset.Charset; public class Main { public static String buffer2String(ByteBuffer buff, String charsetName) { return Charset.forName(charsetName).decode(buff).toString(); }/*from w w w .ja v a2 s .c om*/ }