Module org.refcodes.io
Package org.refcodes.io
Interface DatagramDestination<DATA extends Serializable>
-
- Type Parameters:
DATA
- The type of the datagram to be operated with. In case you wish to use array types, you might better use theDatagramsReceiver
type.
- All Known Subinterfaces:
BidirectionalConnectionTransceiver<DATA,INPUT,OUTPUT>
,BidirectionalStreamConnectionTransceiver<DATA>
,ConnectionDatagramsReceiver<DATA,CON>
,ConnectionDatagramsTransceiver<DATA,CON>
,DatagramReceiver<DATA>
,DatagramsDestination<DATA>
,DatagramsReceiver<DATA>
,DatagramsTransceiver<DATA>
,DatagramTransceiver<DATA>
,InputStreamConnectionReceiver<DATA>
- All Known Implementing Classes:
AbstractDatagramsReceiver
,AbstractInputStreamReceiver
,AbstractPrefetchInputStreamReceiver
,BidirectionalStreamConnectionTransceiverImpl
,BidirectionalStreamTransceiver
,DatagramsReceiverDecorator
,InputStreamConnectionReceiverImpl
,InputStreamReceiver
,LoopbackDatagramsReceiver
,LoopbackDatagramsTransceiver
,PrefetchBidirectionalStreamConnectionTransceiver
,PrefetchBidirectionalStreamTransceiver
,PrefetchInputStreamConnectionReceiver
,PrefetchInputStreamReceiver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface DatagramDestination<DATA extends Serializable>
TheDatagramDestination
is used to receive datagrams in a unified way. Thereceive()
method provides the next available datagram from the counterpartDatagramSource
; in case there is none available.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DATA
receive()
Reads (receives) the next datagram passed from aDatagramTransmitter
counterpart.
-
-
-
Method Detail
-
receive
DATA receive() throws IOException, EOFException
Reads (receives) the next datagram passed from aDatagramTransmitter
counterpart. In case none datagram is available, then this method blocks until one is available. To prevent blocking, use theDatagramReceiver
extension'sAvailability.available()
method to test beforehand whether a byte is available (in a multi-threaded usage scenario,Availability.available()
is not a reliable indicator whether this method will block or not). When aThread
is waiting for a datagram to be read andThread.interrupt()
is being called, then the operation is aborted and anInterruptedException
is thrown.- Returns:
- The next datagram sent from the
DatagramTransmitter
counterpart. - Throws:
IOException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.EOFException
- Signals that an end of file or end of stream has been reached unexpectedly during input.
-
-