org.redkale.net

## 类 AsyncConnection

- java.lang.Object
- - org.redkale.net.AsyncConnection

- 所有已实现的接口:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.AsynchronousByteChannel, java.nio.channels.AsynchronousChannel, java.nio.channels.Channel

      public abstract class AsyncConnection
      extends java.lang.Object
      implements java.nio.channels.AsynchronousByteChannel, java.lang.AutoCloseable

  详情见: https://redkale.org

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected java.util.Map<java.lang.String,java.lang.Object>` | `attributes`
    `protected java.lang.Object` | `subobject`

  - ### 构造器概要

    构造器
    构造器和说明
    `AsyncConnection()`

  - ### 方法概要

    所有方法 静态方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `clearAttribute()`
    `void` | `close()`
    `static AsyncConnection` | `create(java.nio.channels.AsynchronousSocketChannel ch)`
    `static AsyncConnection` | `create(java.nio.channels.AsynchronousSocketChannel ch, java.net.SocketAddress addr0, int readTimeoutSecond0, int writeTimeoutSecond0)`
    `static AsyncConnection` | `create(java.nio.channels.DatagramChannel ch, java.net.SocketAddress addr, boolean client0, int readTimeoutSecond0, int writeTimeoutSecond0)`
    `static AsyncConnection` | `create(java.net.Socket socket)` 通常用于 ssl socket
    `static AsyncConnection` | `create(java.net.Socket socket, java.net.SocketAddress addr0, int readTimeoutSecond0, int writeTimeoutSecond0)`
    `static AsyncConnection` | `create(java.lang.String protocol, java.nio.channels.AsynchronousChannelGroup group, java.net.SocketAddress address)`
    `static AsyncConnection` | `create(java.lang.String protocol, java.nio.channels.AsynchronousChannelGroup group, java.net.SocketAddress address, int readTimeoutSecond0, int writeTimeoutSecond0)` 创建客户端连接
    `void` | `dispose()`
    `<T> T` | `getAttribute(java.lang.String name)`
    `java.util.Map<java.lang.String,java.lang.Object>` | `getAttributes()`
    `abstract java.net.SocketAddress` | `getLocalAddress()`
    `abstract int` | `getReadTimeoutSecond()`
    `abstract java.net.SocketAddress` | `getRemoteAddress()`
    `<T> T` | `getSubobject()`
    `abstract int` | `getWriteTimeoutSecond()`
    `abstract boolean` | `isTCP()`
    `void` | `removeAttribute(java.lang.String name)`
    `void` | `setAttribute(java.lang.String name, java.lang.Object value)`
    `abstract void` | `setReadTimeoutSecond(int readTimeoutSecond)`
    `void` | `setSubobject(java.lang.Object value)`
    `abstract void` | `setWriteTimeoutSecond(int writeTimeoutSecond)`
    `<A> void` | `write(java.nio.ByteBuffer[] srcs, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)`
    `protected abstract <A> void` | `write(java.nio.ByteBuffer[] srcs, int offset, int length, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### 从接口继承的方法 java.nio.channels.AsynchronousByteChannel

      `read, read, write, write`

    - ### 从接口继承的方法 java.nio.channels.Channel

      `isOpen`

- - ### 字段详细资料

    - #### attributes

          protected java.util.Map<java.lang.String,java.lang.Object> attributes

    - #### subobject

          protected java.lang.Object subobject

  - ### 构造器详细资料

    - #### AsyncConnection

          public AsyncConnection()

  - ### 方法详细资料

    - #### isTCP

          public abstract boolean isTCP()

    - #### getRemoteAddress

          public abstract java.net.SocketAddress getRemoteAddress()

    - #### getLocalAddress

          public abstract java.net.SocketAddress getLocalAddress()

    - #### getReadTimeoutSecond

          public abstract int getReadTimeoutSecond()

    - #### getWriteTimeoutSecond

          public abstract int getWriteTimeoutSecond()

    - #### setReadTimeoutSecond

          public abstract void setReadTimeoutSecond(int readTimeoutSecond)

    - #### setWriteTimeoutSecond

          public abstract void setWriteTimeoutSecond(int writeTimeoutSecond)

    - #### write

          public final <A> void write(java.nio.ByteBuffer[] srcs,
                                      A attachment,
                                      java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)

    - #### write

          protected abstract <A> void write(java.nio.ByteBuffer[] srcs,
                                            int offset,
                                            int length,
                                            A attachment,
                                            java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)

    - #### dispose

          public void dispose()

    - #### close

          public void close()
                     throws java.io.IOException

      指定者:
        `close` 在接口中 `java.io.Closeable`
      指定者:
        `close` 在接口中 `java.lang.AutoCloseable`
      指定者:
        `close` 在接口中 `java.nio.channels.AsynchronousChannel`
      指定者:
        `close` 在接口中 `java.nio.channels.Channel`
      抛出:
        `java.io.IOException`

    - #### getSubobject

          public final <T> T getSubobject()

    - #### setSubobject

          public void setSubobject(java.lang.Object value)

    - #### setAttribute

          public void setAttribute(java.lang.String name,
                                   java.lang.Object value)

    - #### getAttribute

          public final <T> T getAttribute(java.lang.String name)

    - #### removeAttribute

          public final void removeAttribute(java.lang.String name)

    - #### getAttributes

          public final java.util.Map<java.lang.String,java.lang.Object> getAttributes()

    - #### clearAttribute

          public final void clearAttribute()

    - #### create

          public static AsyncConnection create(java.lang.String protocol,
                                               java.nio.channels.AsynchronousChannelGroup group,
                                               java.net.SocketAddress address)
                                        throws java.io.IOException

      抛出:
        `java.io.IOException`

    - #### create

          public static AsyncConnection create(java.lang.String protocol,
                                               java.nio.channels.AsynchronousChannelGroup group,
                                               java.net.SocketAddress address,
                                               int readTimeoutSecond0,
                                               int writeTimeoutSecond0)
                                        throws java.io.IOException

      创建客户端连接
      参数:
        `protocol` - 连接类型 只能是TCP或UDP
        `address` - 连接点子
        `group` - 连接AsynchronousChannelGroup
        `readTimeoutSecond0` - 读取超时秒数
        `writeTimeoutSecond0` - 写入超时秒数
      返回:
        连接
      抛出:
        `java.io.IOException` - 异常

    - #### create

          public static AsyncConnection create(java.nio.channels.DatagramChannel ch,
                                               java.net.SocketAddress addr,
                                               boolean client0,
                                               int readTimeoutSecond0,
                                               int writeTimeoutSecond0)

    - #### create

          public static AsyncConnection create(java.net.Socket socket)

      通常用于 ssl socket
      参数:
        `socket` - Socket对象
      返回:
        连接对象

    - #### create

          public static AsyncConnection create(java.net.Socket socket,
                                               java.net.SocketAddress addr0,
                                               int readTimeoutSecond0,
                                               int writeTimeoutSecond0)

    - #### create

          public static AsyncConnection create(java.nio.channels.AsynchronousSocketChannel ch)

    - #### create

          public static AsyncConnection create(java.nio.channels.AsynchronousSocketChannel ch,
                                               java.net.SocketAddress addr0,
                                               int readTimeoutSecond0,
                                               int writeTimeoutSecond0)