I had thought of that, but what if you have text/strings that are then followed by more ints or floats, etc?
In that case you're going to have to store the length of the string byte array in the ByteBuffer before the string itself. Then simply retrieve the length of the string byte array , and use the following:
int retStringLength = b.getInt();
byte strByteArray = new byte[retStringLength];
String gotcha = new String(strByteArray);
that ought to work. Although of course you probably don't want to use an int for the length, a short or even a byte will probably do for ya depending on what you're sending.