class PreReadSocketChannel extends DelegatingSocketChannel<SocketChannel>
DatagramPacket
to a SocketChannel
. In other words,
enables looking ahead at the byte
s of a SocketChannel
.Modifier and Type | Field and Description |
---|---|
private DatagramPacket |
preRead
The
DatagramPacket which is to be prepended to the
SocketChannel which is the BaseDelegatingSocketChannel.delegate of this
DelegatingSocketChannel . |
delegateAsSelChImpl
delegate
Constructor and Description |
---|
PreReadSocketChannel(DatagramPacket preRead,
SocketChannel delegate)
Initializes a new
PreReadSocketChannel instance which is to
prepend a specific DatagramPacket to a specific
SocketChannel . |
Modifier and Type | Method and Description |
---|---|
int |
read(ByteBuffer dst)
Forwards to
BaseDelegatingSocketChannel.delegate . |
getFD, getFDVal, kill, translateAndSetInterestOps, translateAndSetReadyOps, translateAndUpdateReadyOps
bind, connect, finishConnect, getLocalAddress, getOption, getRemoteAddress, implCloseSelectableChannel, implConfigureBlocking, implSocket, isConnected, isConnectionPending, read, setOption, shutdownInput, shutdownOutput, socket, supportedOptions, write, write
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
register
begin, close, end, isOpen
private final DatagramPacket preRead
DatagramPacket
which is to be prepended to the
SocketChannel
which is the BaseDelegatingSocketChannel.delegate
of this
DelegatingSocketChannel
.public PreReadSocketChannel(DatagramPacket preRead, SocketChannel delegate)
PreReadSocketChannel
instance which is to
prepend a specific DatagramPacket
to a specific
SocketChannel
.preRead
- the DatagramPacket
to prepend to delegate
delegate
- the SocketChannel
to prepend preRead
topublic int read(ByteBuffer dst) throws IOException
BaseDelegatingSocketChannel.delegate
.
Reads from preRead
first (until it is fully read) and then
continues with the super
implementation.read
in interface ReadableByteChannel
read
in class BaseDelegatingSocketChannel<SocketChannel>
IOException
Copyright © 2018. All rights reserved.