public String readNullTerminatedBytes() throws IOException {
  StringBuilder buf=new StringBuilder();
  while (true) {
    byte letter=(byte)ins.read();
    if (letter == -1)     throw new IOException("readNullTerminatedBytes(): failed (EOF)");
    if (letter == 0)     break;
 else     buf.append((char)letter);
  }
  return buf.toString();
}

public String readNullTerminatedBytes ( ) throws IOException { StringBuilder buf = new StringBuilder ( ) ; while ( true ) { byte letter = ( byte ) ins . read ( ) ; if ( letter == - 1 ) throw new IOException ( "readNullTerminatedBytes(): failed (EOF)" ) ; if ( letter == 0 ) break ; else buf . append ( ( char ) letter ) ; } return buf . toString ( ) ; }
reads a null - terminated string
