Here you can find the source of readString(ByteBuffer bb)
public static String readString(ByteBuffer bb)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static String readString(ByteBuffer bb) { int len = (int) bb.getShort(); byte[] stringBytes = new byte[len]; bb.get(stringBytes);/*from w w w .j a v a2 s . c o m*/ return new String(stringBytes); } }