Package 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 Description ClosedNioChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this channel.void
free()
Free the channel memoryboolean
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(java.nio.channels.SocketChannel channel, NioEndpoint.NioSocketWrapper socketWrapper)
Reset the channelvoid
setAppReadBufHandler(ApplicationBufferHandler handler)
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
-
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException
Description copied from class:NioChannel
Closes this channel.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classNioChannel
- 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 interfacejava.nio.channels.Channel
- Overrides:
isOpen
in classNioChannel
- Returns:
true
if, and only if, this channel is open
-
reset
public void reset(java.nio.channels.SocketChannel channel, NioEndpoint.NioSocketWrapper socketWrapper) throws java.io.IOException
Description copied from class:NioChannel
Reset the channel- Overrides:
reset
in classNioChannel
- Parameters:
channel
- the socket channelsocketWrapper
- the socket wrapper- 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 classNioChannel
-
setAppReadBufHandler
public void setAppReadBufHandler(ApplicationBufferHandler handler)
- Overrides:
setAppReadBufHandler
in classNioChannel
-
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 interfacejava.nio.channels.ReadableByteChannel
- Overrides:
read
in classNioChannel
- 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 interfacejava.nio.channels.ScatteringByteChannel
- Overrides:
read
in classNioChannel
- 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 interfacejava.nio.channels.WritableByteChannel
- Overrides:
write
in classNioChannel
- 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 interfacejava.nio.channels.GatheringByteChannel
- Overrides:
write
in classNioChannel
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classNioChannel
-
-