DATA- the generic type
@FunctionalInterface public interface DatagramsDestination<DATA extends Serializable> extends DatagramDestination<DATA>
|Modifier and Type||Method||Description|
Reads (receives) the next datagram passed from a
Receives a byte array with the number of datagrams specified inserted at the given offset.
Reads (receives) the all currently available data.
DATA receive() throws IOException
DatagramTransmittercounterpart. In case none datagram is available, then this method blocks until one is available. To prevent blocking, use the
Availability.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 a
Threadis waiting for a datagram to be read and
Thread.interrupt()is being called, then the operation is aborted and an
default DATA receiveAll() throws IOException
default DATA receive(int aMaxSize) throws IOException
receiveAll()though at maximum the amount of data as provided returned.
default void receive(DATA aBuffer, int aOffset, int aLength) throws IOException
aBuffer- The datagrams array where to store the datagrams at.
aOffset- The offset where to start storing the received datagrams.
aLength- The number of datagrams to receive.
IOException- thrown in case of I/O issues (e.g. a timeout) while receiving.
Copyright © 2021. All rights reserved.