public String readNullTerminatedString(){
  if (bytesLeft() == 0) {
    return null;
  }
  int stringLimit=position;
  while (stringLimit < limit && data[stringLimit] != 0) {
    stringLimit++;
  }
  final int length=stringLimit - position;
  String result=new String(data,position,length,Charset.defaultCharset());
  position=stringLimit;
  if (position == limit) {
    return result;
  }
  position++;
  return result;
}

public String readNullTerminatedString ( ) { if ( bytesLeft ( ) == 0 ) { return null ; } int stringLimit = position ; while ( stringLimit < limit && data [ stringLimit ] != 0 ) { stringLimit ++ ; } final int length = stringLimit - position ; String result = new String ( data , position , length , Charset . defaultCharset ( ) ) ; position = stringLimit ; if ( position == limit ) { return result ; } position ++ ; return result ; }
reads a null - terminated string using the default character set .
