@Override public int readTimeout(byte[] buf,int offset,int length,long timeout) throws IOException {
  Socket s=_s;
  if (s == null) {
    return -1;
  }
  int oldTimeout=s.getSoTimeout();
  s.setSoTimeout((int)timeout);
  try {
    int result=read(buf,offset,length);
    if (result >= 0) {
      return result;
    }
 else     if (_is == null || _is.available() < 0) {
      return -1;
    }
 else {
      return ReadStream.READ_TIMEOUT;
    }
  }
  finally {
    s.setSoTimeout(oldTimeout);
  }
}

@ Override public int readTimeout ( byte [ ] buf , int offset , int length , long timeout ) throws IOException { Socket s = _s ; if ( s == null ) { return - 1 ; } int oldTimeout = s . getSoTimeout ( ) ; s . setSoTimeout ( ( int ) timeout ) ; try { int result = read ( buf , offset , length ) ; if ( result >= 0 ) { return result ; } else if ( _is == null || _is . available ( ) < 0 ) { return - 1 ; } else { return ReadStream . READ_TIMEOUT ; } } finally { s . setSoTimeout ( oldTimeout ) ; } }
reads bytes from the socket .
