/** Translates native poll revent set into a ready operation set */
  public boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl sk) {
    int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
    int oldOps = sk.nioReadyOps();
    int newOps = initialOps;

    if ((ops & Net.POLLNVAL) != 0) {
      // This should only happen if this channel is pre-closed while a
      // selection operation is in progress
      // ## Throw an error if this channel has not been pre-closed
      return false;
    }

    if ((ops & (Net.POLLERR | Net.POLLHUP)) != 0) {
      newOps = intOps;
      sk.nioReadyOps(newOps);
      return (newOps & ~oldOps) != 0;
    }

    if (((ops & Net.POLLIN) != 0) && ((intOps & SelectionKey.OP_READ) != 0))
      newOps |= SelectionKey.OP_READ;

    if (((ops & Net.POLLOUT) != 0) && ((intOps & SelectionKey.OP_WRITE) != 0))
      newOps |= SelectionKey.OP_WRITE;

    sk.nioReadyOps(newOps);
    return (newOps & ~oldOps) != 0;
  }
 public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
   return translateReadyOps(ops, sk.nioReadyOps(), sk);
 }