Code example for SelectionKey

Methods: interestOpsselector

0
 
        /** 
         * Enables write I/O callbacks. 
         */ 
        private void enableWrite() { 
            mSelectionKey.interestOps(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
            // Looks like we must wake up the selector. Otherwise it's not going 
            // to immediately pick up on the change that we just made. 
            mSelectionKey.selector().wakeup();
        } 
 
        /** 
         * Disables write I/O callbacks. 
         */ 
        private void disableWrite() { 
            mSelectionKey.interestOps(SelectionKey.OP_READ);
        } 
    } // EmulatorChannel 
 
    /*************************************************************************** 
     * EmulatorConnection public API