Here you can find the source of getStringRepresentation(ByteBuffer key)
public static String getStringRepresentation(ByteBuffer key)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; public class Main { public static String getStringRepresentation(ByteBuffer key) { Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); String keyName = null;/*from w w w . ja v a 2 s .c o m*/ ByteBuffer keyNameByteBuffer = key.duplicate(); CharBuffer keyNameCharBuffer; try { keyNameCharBuffer = decoder.decode(keyNameByteBuffer); keyName = keyNameCharBuffer.toString(); } catch (CharacterCodingException e1) { e1.printStackTrace(); } return keyName; } }