public static String utf8(final ByteBuffer bb) {
    // performance is not very critical here so we always copy the BB to a byte array
    byte[] buf = new byte[bb.remaining()];
    // duplicate so the get will not change the position of the original bb
    bb.duplicate().get(buf);
    return utf8(buf);
  }
Helper to translate a byte buffer to UTF8 strings
@param bb byte buffer
@return UTF8 decoded string value
hbase-examples/src/main/java/org/apache/hadoop/hbase/util/ClientUtils.java