Top Description Fields Constructors Methods
org.eclipse.jetty.io

public Class DatagramChannelEndPoint

extends SelectableChannelEndPoint
Class Inheritance
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.DatagramChannel, .SelectionKey, .WritePendingException, org.eclipse.jetty.util.BufferUtil, .Callback, org.eclipse.jetty.util.thread.Scheduler, org.slf4j.Logger, .LoggerFactory

An EndPoint implementation based on DatagramChannel.

Field Summary

Modifier and TypeField and Description
public static final SocketAddress
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DatagramChannel
public SocketAddress
public SocketAddress

Returns:

the peer address that sent the data
receive
(ByteBuffer
the buffer to fill with data
buffer
)

Receives data into the given buffer from the returned address.

public boolean

Returns:

true if all the buffers have been consumed
send
(SocketAddress
the peer address to send data to
address
,
ByteBuffer...
the buffers containing the data to send
buffers
)

Sends to the given address the data in the given buffers.

public void
write(Callback
the callback to notify of the success or failure of the write operation
callback
,
SocketAddress
the peer address to send data to
address
,
ByteBuffer...
the buffers containing the data to send
buffers
)

Writes to the given address the data contained in the given buffers, and invokes the given callback when either all the data has been sent, or a failure occurs.

Inherited from org.eclipse.jetty.io.SelectableChannelEndPoint:
doClosegetLocalSocketAddressgetTransportisOpenneedsFillInterestonCloseonIncompleteFlushonSelectedreplaceKeytoEndPointStringupdateKey

Field Detail

EOFback to summary
public static final SocketAddress EOF
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.io.SelectableChannelEndPoint.LOG.

Constructor Detail

DatagramChannelEndPointback to summary
public DatagramChannelEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey key, Scheduler scheduler)

Method Detail

getChannelback to summary
public DatagramChannel getChannel()

Overrides org.eclipse.jetty.io.SelectableChannelEndPoint.getChannel.

Annotations
@Override
getRemoteSocketAddressback to summary
public SocketAddress getRemoteSocketAddress()

Overrides default org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

Implements abstract org.eclipse.jetty.io.AbstractEndPoint.getRemoteSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

The remote SocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.

Annotations
@Override
receiveback to summary
public SocketAddress receive(ByteBuffer buffer) throws IOException

Receives data into the given buffer from the returned address.

This method should be used to receive UDP data.

Parameters
buffer:ByteBuffer

the buffer to fill with data

Returns:SocketAddress

the peer address that sent the data

Exceptions
IOException:
if the receive fails
sendback to summary
public boolean send(SocketAddress address, ByteBuffer... buffers) throws IOException

Sends to the given address the data in the given buffers.

This methods should be used to send UDP data.

Parameters
address:SocketAddress

the peer address to send data to

buffers:ByteBuffer[]

the buffers containing the data to send

Returns:boolean

true if all the buffers have been consumed

Exceptions
IOException:
if the send fails
See Also
write(Callback, SocketAddress, ByteBuffer...)
writeback to summary
public void write(Callback callback, SocketAddress address, ByteBuffer... buffers) throws WritePendingException

Writes to the given address the data contained in the given buffers, and invokes the given callback when either all the data has been sent, or a failure occurs.

Parameters
callback:Callback

the callback to notify of the success or failure of the write operation

address:SocketAddress

the peer address to send data to

buffers:ByteBuffer[]

the buffers containing the data to send

Exceptions
WritePendingException:
if a previous write was initiated but was not yet completed
See Also
send(SocketAddress, ByteBuffer...)