java.io.Closeable, java.lang.AutoCloseable, EndPointSelectChannelEndPointpublic class ChannelEndPoint extends AbstractEndPoint
Holds the channel and socket for an NIO endpoint.
| Constructor | Description |
|---|---|
ChannelEndPoint(Scheduler scheduler,
java.nio.channels.SocketChannel channel) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close any backing stream associated with the endpoint
|
int |
fill(java.nio.ByteBuffer buffer) |
Fill the passed buffer with data from this endpoint.
|
boolean |
flush(java.nio.ByteBuffer... buffers) |
Flush data from the passed header/buffer to this endpoint.
|
java.nio.channels.ByteChannel |
getChannel() |
|
java.net.Socket |
getSocket() |
|
java.lang.Object |
getTransport() |
|
boolean |
isInputShutdown() |
Test if the input is shutdown.
|
boolean |
isOpen() |
This abstract method should be called to check if idle timeouts
should still be checked.
|
boolean |
isOptimizedForDirectBuffers() |
Is the endpoint optimized for DirectBuffer usage
|
boolean |
isOutputShutdown() |
Test if output is shutdown.
|
protected void |
needsFillInterest() |
|
protected void |
onIncompleteFlush() |
|
protected void |
shutdownInput() |
|
void |
shutdownOutput() |
Shutdown the output.
|
close, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, onIdleExpired, onOpen, setConnection, toString, tryFillInterested, upgrade, writegetIdleTimeout, onClose, setIdleTimeoutcheckIdleTimeout, getIdleFor, getIdleTimeout, getIdleTimestamp, getScheduler, notIdle, onClose, setIdleTimeoutpublic ChannelEndPoint(Scheduler scheduler, java.nio.channels.SocketChannel channel)
public boolean isOptimizedForDirectBuffers()
EndPointisOptimizedForDirectBuffers in interface EndPointisOptimizedForDirectBuffers in class AbstractEndPointpublic boolean isOpen()
IdleTimeoutisOpen in interface EndPointisOpen in class IdleTimeoutprotected void shutdownInput()
public void shutdownOutput()
EndPointThis call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.
If the endpoint has EndPoint.isInputShutdown() true, then this call has the same effect
as EndPoint.close().
public boolean isOutputShutdown()
EndPointEndPoint.shutdownOutput()
or EndPoint.close().public boolean isInputShutdown()
EndPointEndPoint.fill(ByteBuffer). Once the input is shutdown, all calls to
EndPoint.fill(ByteBuffer) will return -1, until such time as the
end point is close, when they will return EofException.public void close()
EndPointclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface EndPointclose in class AbstractEndPointpublic int fill(java.nio.ByteBuffer buffer)
throws java.io.IOException
EndPointbuffer - The buffer to fill. The position and limit are modified during the fill. After the
operation, the position is unchanged and the limit is increased to reflect the new data filled.int value indicating the number of bytes
filled or -1 if EOF is read or the input is shutdown.java.io.IOException - if the endpoint is closed.public boolean flush(java.nio.ByteBuffer... buffers)
throws java.io.IOException
EndPointbuffers - the buffers to flushjava.io.IOException - If the endpoint is closed or output is shutdown.public java.nio.channels.ByteChannel getChannel()
public java.lang.Object getTransport()
public java.net.Socket getSocket()
protected void onIncompleteFlush()
onIncompleteFlush in class AbstractEndPointprotected void needsFillInterest()
throws java.io.IOException
needsFillInterest in class AbstractEndPointjava.io.IOExceptionCopyright © 1995–2018 Webtide. All rights reserved.