public class NioChannel
extends java.lang.Object
implements java.nio.channels.ByteChannel
Modifier and Type | Field and Description |
---|---|
protected SecureNioChannel.ApplicationBufferHandler |
bufHandler |
protected static java.nio.ByteBuffer |
emptyBuf |
protected NioEndpoint.Poller |
poller |
protected java.nio.channels.SocketChannel |
sc |
protected static StringManager |
sm |
Constructor and Description |
---|
NioChannel(java.nio.channels.SocketChannel channel,
SecureNioChannel.ApplicationBufferHandler bufHandler) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkInterruptStatus()
This method should be used to check the interrupt status before
attempting a write.
|
void |
close()
Closes this channel.
|
void |
close(boolean force) |
boolean |
flush(boolean block,
java.nio.channels.Selector s,
long timeout)
Returns true if the network buffer has been flushed out and is empty.
|
boolean |
flushOutbound()
Return true if the buffer wrote data
|
java.lang.Object |
getAttachment() |
int |
getBufferSize() |
SecureNioChannel.ApplicationBufferHandler |
getBufHandler()
getBufHandler
|
java.nio.channels.SocketChannel |
getIOChannel()
getIOChannel
|
int |
getOutboundRemaining() |
NioEndpoint.Poller |
getPoller() |
int |
handshake(boolean read,
boolean write) |
boolean |
isClosing()
isClosing
|
boolean |
isHandshakeComplete()
isInitHandshakeComplete
|
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.
|
void |
reset() |
void |
setIOChannel(java.nio.channels.SocketChannel IOChannel) |
void |
setPoller(NioEndpoint.Poller poller) |
java.lang.String |
toString() |
int |
write(java.nio.ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer.
|
protected static final StringManager sm
protected static java.nio.ByteBuffer emptyBuf
protected java.nio.channels.SocketChannel sc
protected SecureNioChannel.ApplicationBufferHandler bufHandler
protected NioEndpoint.Poller poller
public NioChannel(java.nio.channels.SocketChannel channel, SecureNioChannel.ApplicationBufferHandler bufHandler) throws java.io.IOException
java.io.IOException
public void reset() throws java.io.IOException
java.io.IOException
public int getBufferSize()
public boolean flush(boolean block, java.nio.channels.Selector s, long timeout) throws java.io.IOException
block
- Unused. May be used when overriddens
- Unused. May be used when overriddentimeout
- Unused. May be used when overriddentrue
since there is no network buffer
in the regular channeljava.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException
- If an I/O error occurs
TODO Implement this java.nio.channels.Channel methodpublic void close(boolean force) throws java.io.IOException
java.io.IOException
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public int write(java.nio.ByteBuffer src) throws java.io.IOException
write
in interface java.nio.channels.WritableByteChannel
src
- The buffer from which bytes are to be retrievedjava.io.IOException
- If some other I/O error occurs
TODO Implement this java.nio.channels.WritableByteChannel methodpublic int read(java.nio.ByteBuffer dst) throws java.io.IOException
read
in interface java.nio.channels.ReadableByteChannel
dst
- The buffer into which bytes are to be transferredjava.io.IOException
- If some other I/O error occurs
TODO Implement this java.nio.channels.ReadableByteChannel methodpublic java.lang.Object getAttachment()
public SecureNioChannel.ApplicationBufferHandler getBufHandler()
public NioEndpoint.Poller getPoller()
public java.nio.channels.SocketChannel getIOChannel()
public boolean isClosing()
public boolean isHandshakeComplete()
public int handshake(boolean read, boolean write) throws java.io.IOException
java.io.IOException
public void setPoller(NioEndpoint.Poller poller)
public void setIOChannel(java.nio.channels.SocketChannel IOChannel)
public java.lang.String toString()
toString
in class java.lang.Object
public int getOutboundRemaining()
public boolean flushOutbound() throws java.io.IOException
java.io.IOException
protected void checkInterruptStatus() throws java.io.IOException
java.io.IOException
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.