public String decode(ByteBuffer buffer){
  byte b=buffer.get();
  if ((b & 0x80) == 0) {
    return readAscii(buffer);
  }
 else {
    int charCount=readLength(b,buffer);
switch (charCount) {
case 0:
      return null;
case 1:
    return "";
}
charCount--;
char[] chars=new char[charCount];
readAsciiFirst(charCount,chars,buffer);
return new String(chars,0,charCount);
}
}

public String decode ( ByteBuffer buffer ) { byte b = buffer . get ( ) ; if ( ( b & 0x80 ) == 0 ) { return readAscii ( buffer ) ; } else { int charCount = readLength ( b , buffer ) ; switch ( charCount ) { case 0 : return null ; case 1 : return "" ; } charCount -- ; char [ ] chars = new char [ charCount ] ; readAsciiFirst ( charCount , chars , buffer ) ; return new String ( chars , 0 , charCount ) ; } }
decode the string from the byte buffer . the input byte buffer should be readable , and it read from its current position .
