NioChannel.ClosedNioChannel (Apache Tomcat 9.0.22 API Documentation)

org.apache.tomcat.util.net

## Class NioChannel.ClosedNioChannel

- java.lang.Object
- - org.apache.tomcat.util.net.NioChannel
  - - org.apache.tomcat.util.net.NioChannel.ClosedNioChannel

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.GatheringByteChannel, java.nio.channels.ReadableByteChannel, java.nio.channels.ScatteringByteChannel, java.nio.channels.WritableByteChannel
  Enclosing class:
    NioChannel

      public static class NioChannel.ClosedNioChannel
      extends NioChannel

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.tomcat.util.net.NioChannel

      `NioChannel.ClosedNioChannel`

  - ### Field Summary

    - ### Fields inherited from class org.apache.tomcat.util.net.NioChannel

      `bufHandler, emptyBuf, sc, sm, socketWrapper`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClosedNioChannel()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this channel.
    `void` | `free()` Free the channel memory
    `boolean` | `isOpen()` Tells whether or not this channel is open.
    `int` | `read(java.nio.ByteBuffer dst)` Reads a sequence of bytes from this channel into the given buffer.
    `long` | `read(java.nio.ByteBuffer[] dsts, int offset, int length)`
    `void` | `reset()` Reset the channel
    `void` | `setAppReadBufHandler(ApplicationBufferHandler handler)`
    `void` | `setIOChannel(java.nio.channels.SocketChannel sc)`
    `java.lang.String` | `toString()`
    `int` | `write(java.nio.ByteBuffer src)` Writes a sequence of bytes to this channel from the given buffer.
    `long` | `write(java.nio.ByteBuffer[] srcs, int offset, int length)`

    - ### Methods inherited from class org.apache.tomcat.util.net.NioChannel

      `checkInterruptStatus, close, flush, flushOutbound, getAppReadBufHandler, getBufHandler, getIOChannel, getOutboundRemaining, handshake, isClosing, isHandshakeComplete, read, write`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### ClosedNioChannel

          public ClosedNioChannel()

  - ### Method Detail

    - #### close

          public void close()
                     throws java.io.IOException

      Description copied from class: `NioChannel`
      Closes this channel.
      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.nio.channels.Channel`
      Overrides:
        `close` in class `NioChannel`
      Throws:
        `java.io.IOException` - If an I/O error occurs

    - #### isOpen

          public boolean isOpen()

      Description copied from class: `NioChannel`
      Tells whether or not this channel is open.
      Specified by:
        `isOpen` in interface `java.nio.channels.Channel`
      Overrides:
        `isOpen` in class `NioChannel`
      Returns:
        `true` if, and only if, this channel is open

    - #### reset

          public void reset()
                     throws java.io.IOException

      Description copied from class: `NioChannel`
      Reset the channel
      Overrides:
        `reset` in class `NioChannel`
      Throws:
        `java.io.IOException` - If a problem was encountered resetting the channel

    - #### free

          public void free()

      Description copied from class: `NioChannel`
      Free the channel memory
      Overrides:
        `free` in class `NioChannel`

    - #### setIOChannel

          public void setIOChannel(java.nio.channels.SocketChannel sc)

      Overrides:
        `setIOChannel` in class `NioChannel`

    - #### setAppReadBufHandler

          public void setAppReadBufHandler(ApplicationBufferHandler handler)

      Overrides:
        `setAppReadBufHandler` in class `NioChannel`

    - #### read

          public int read(java.nio.ByteBuffer dst)
                   throws java.io.IOException

      Description copied from class: `NioChannel`
      Reads a sequence of bytes from this channel into the given buffer.
      Specified by:
        `read` in interface `java.nio.channels.ReadableByteChannel`
      Overrides:
        `read` in class `NioChannel`
      Parameters:
        `dst` - The buffer into which bytes are to be transferred
      Returns:
        The number of bytes read, possibly zero, or `-1` if the channel has reached end-of-stream
      Throws:
        `java.io.IOException` - If some other I/O error occurs

    - #### read

          public long read(java.nio.ByteBuffer[] dsts,
                           int offset,
                           int length)
                    throws java.io.IOException

      Specified by:
        `read` in interface `java.nio.channels.ScatteringByteChannel`
      Overrides:
        `read` in class `NioChannel`
      Throws:
        `java.io.IOException`

    - #### write

          public int write(java.nio.ByteBuffer src)
                    throws java.io.IOException

      Description copied from class: `NioChannel`
      Writes a sequence of bytes to this channel from the given buffer.
      Specified by:
        `write` in interface `java.nio.channels.WritableByteChannel`
      Overrides:
        `write` in class `NioChannel`
      Parameters:
        `src` - The buffer from which bytes are to be retrieved
      Returns:
        The number of bytes written, possibly zero
      Throws:
        `java.io.IOException` - If some other I/O error occurs

    - #### write

          public long write(java.nio.ByteBuffer[] srcs,
                            int offset,
                            int length)
                     throws java.io.IOException

      Specified by:
        `write` in interface `java.nio.channels.GatheringByteChannel`
      Overrides:
        `write` in class `NioChannel`
      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `NioChannel`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.