Home / Class/ NioIoOps Class — netty Architecture

NioIoOps Class — netty Architecture

Architecture documentation for the NioIoOps class in NioIoOps.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cd45b0d4_61fb_27e1_625f_a11e4135ec28["NioIoOps"]
  6b9eb612_2eed_3658_455c_1a0ec057740a["NioIoOps.java"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|defined in| 6b9eb612_2eed_3658_455c_1a0ec057740a
  80856161_0c79_b831_2fe8_c3aba5b4ccc8["addToArray()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 80856161_0c79_b831_2fe8_c3aba5b4ccc8
  bba0bd8f_ec07_fd94_f054_70f129b41f93["NioIoOps()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| bba0bd8f_ec07_fd94_f054_70f129b41f93
  e2ee9c5b_5afc_b351_bd62_2ce0be553fa6["contains()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| e2ee9c5b_5afc_b351_bd62_2ce0be553fa6
  3a2a3a7f_ad16_49d0_9261_233b6d903ee3["value()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 3a2a3a7f_ad16_49d0_9261_233b6d903ee3
  21ca9061_9869_06ab_d660_0441b4f75434["equals()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 21ca9061_9869_06ab_d660_0441b4f75434
  253d4c2e_9522_2305_4be3_3bd01d5e7385["hashCode()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 253d4c2e_9522_2305_4be3_3bd01d5e7385
  b4458f63_60f7_54dc_a2f9_876a48b42315["isIncludedIn()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| b4458f63_60f7_54dc_a2f9_876a48b42315
  3c73f50a_1345_b60b_fc6b_3d92060a9ffb["isNotIncludedIn()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 3c73f50a_1345_b60b_fc6b_3d92060a9ffb
  555a2fb1_e279_fcf6_0926_fff4446b1dc8["NioIoEvent()"]
  cd45b0d4_61fb_27e1_625f_a11e4135ec28 -->|method| 555a2fb1_e279_fcf6_0926_fff4446b1dc8

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/nio/NioIoOps.java lines 26–220

public final class NioIoOps implements IoOps {
    /**
     * Interested in NO IO events.
     */
    public static final NioIoOps NONE = new NioIoOps(0);

    /**
     * Interested in IO events that should be handled by accepting new connections
     */
    public static final NioIoOps ACCEPT = new NioIoOps(SelectionKey.OP_ACCEPT);

    /**
     * Interested in IO events which should be handled by finish pending connect operations
     */
    public static final NioIoOps CONNECT = new NioIoOps(SelectionKey.OP_CONNECT);

    /**
     * Interested in IO events which tell that the underlying channel is writable again.
     */
    public static final NioIoOps WRITE = new NioIoOps(SelectionKey.OP_WRITE);

    /**
     * Interested in IO events which should be handled by reading data.
     */
    public static final NioIoOps READ = new NioIoOps(SelectionKey.OP_READ);

    /**
     * Interested in IO events which should be either handled by reading or accepting.
     */
    public static final NioIoOps READ_AND_ACCEPT = new NioIoOps(SelectionKey.OP_READ | SelectionKey.OP_ACCEPT);

    /**
     * Interested in IO events which should be either handled by reading or writing.
     */
    public static final NioIoOps READ_AND_WRITE = new NioIoOps(SelectionKey.OP_READ | SelectionKey.OP_WRITE);

    // Just use an array to store often used values.
    private static final NioIoEvent[] EVENTS;

    static {
        NioIoOps all = new NioIoOps(
                NONE.value | ACCEPT.value | CONNECT.value | WRITE.value | READ.value);

        EVENTS = new NioIoEvent[all.value + 1];
        addToArray(EVENTS, NONE);
        addToArray(EVENTS, ACCEPT);
        addToArray(EVENTS, CONNECT);
        addToArray(EVENTS, WRITE);
        addToArray(EVENTS, READ);
        addToArray(EVENTS, READ_AND_ACCEPT);
        addToArray(EVENTS, READ_AND_WRITE);
        addToArray(EVENTS, all);
    }

    private static void addToArray(NioIoEvent[] array, NioIoOps opt) {
        array[opt.value] = new DefaultNioIoEvent(opt);
    }

    final int value;

    private NioIoOps(int value) {
        this.value = value;
    }

    /**
     * Returns {@code true} if this {@link NioIoOps} is a combination of the given {@link NioIoOps}.
     * @param ops   the ops.
     * @return      {@code true} if a combination of the given.
     */
    public boolean contains(NioIoOps ops) {
        return isIncludedIn(ops.value);
    }

    /**
     * Return a {@link NioIoOps} which is a combination of the current and the given {@link NioIoOps}.
     *
     * @param ops   the {@link NioIoOps} that should be added to this one.
     * @return      a {@link NioIoOps}.
     */
    public NioIoOps with(NioIoOps ops) {
        if (contains(ops)) {

Frequently Asked Questions

What is the NioIoOps class?
NioIoOps is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/nio/NioIoOps.java.
Where is NioIoOps defined?
NioIoOps is defined in transport/src/main/java/io/netty/channel/nio/NioIoOps.java at line 26.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free