Class 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
    • 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.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        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
      • 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