@Override public final String readNullTerminatedAsciiString(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  byte b;
  while (true) {
    b=readByte();
    if (b == 0) {
      break;
    }
    baos.write(b);
  }
  byte[] buf=baos.toByteArray();
  char[] chrBuf=new char[buf.length];
  for (int x=0; x < buf.length; x++) {
    chrBuf[x]=(char)buf[x];
  }
  return String.valueOf(chrBuf);
}

@ Override public final String readNullTerminatedAsciiString ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; byte b ; while ( true ) { b = readByte ( ) ; if ( b == 0 ) { break ; } baos . write ( b ) ; } byte [ ] buf = baos . toByteArray ( ) ; char [ ] chrBuf = new char [ buf . length ] ; for ( int x = 0 ; x < buf . length ; x ++ ) { chrBuf [ x ] = ( char ) buf [ x ] ; } return String . valueOf ( chrBuf ) ; }
reads a null - terminated string from the stream .
