protected byte readByteProtected(DataInputStream istream) throws IOException {
  while (true) {
    int nchars;
    nchars=istream.read(rcvBuffer,0,1);
    if (nchars == -1) {
      throw new IOException("Connection not terminated normally");
    }
    if (nchars > 0) {
      return rcvBuffer[0];
    }
  }
}

protected byte readByteProtected ( DataInputStream istream ) throws IOException { while ( true ) { int nchars ; nchars = istream . read ( rcvBuffer , 0 , 1 ) ; if ( nchars == - 1 ) { throw new IOException ( "Connection not terminated normally" ) ; } if ( nchars > 0 ) { return rcvBuffer [ 0 ] ; } } }
read a single byte , protecting against various timeouts , etc . < p > when a gnu . io port is set to have a receive timeout ( via the enablereceivetimeout ( ) method ) , some will return zero bytes or an eofexception at the end of the timeout . in that case , the read should be repeated to get the next real character .
