Here you can find the source of decodeBuffer(ByteBuffer buffer, String charsetName)
protected static String decodeBuffer(ByteBuffer buffer, String charsetName)
//package com.java2s; import java.io.*; import java.nio.*; public class Main { protected static String decodeBuffer(ByteBuffer buffer, String charsetName) { byte[] bytes = new byte[buffer.limit()]; buffer.get(bytes);/*from ww w .j a va2 s . c o m*/ try { return new String(bytes, charsetName); } catch (UnsupportedEncodingException e) { return new String(bytes); } } }