DATA
- The type of the datagram block (array) to be operated with. Do
not provide an array type as the methods use to generic type for
defining an array argument.@FunctionalInterface public interface BlockProvider<DATA extends Serializable>
BlockProvider
is used to receive datagram blocks (arrays) in a
unified way. The readDatagrams()
method provides the next available
datagram block from the counterpart BlockProvider
or
DatagramProvider
; in case there is none available, then this method
halts until one is available.Modifier and Type | Method and Description |
---|---|
default DATA[] |
readDatagrams()
Reads (receives) the next datagram block passed from a
BlockSender or DatagramSender counterpart. |
DATA[] |
readDatagrams(int aBlockSize)
Similar to
readDatagrams() though at maximum the amount of data
as provided by the block-size is returned. |
default DATA[] readDatagrams() throws org.refcodes.component.OpenException, InterruptedException
BlockSender
or DatagramSender
counterpart. In case none
datagram block is available, then this method blocks until one is
available.
When a Thread
is waiting for a datagram to be read and
Thread.interrupt()
is being called, then the operation is aborted
and an InterruptedException
is thrown.BlockSender
or
DatagramReceiver
counterpart.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.InterruptedException
- Thrown when a Thread
is waiting,
sleeping, or otherwise occupied, and the Thread
is
interrupted, either before or during the activity.DATA[] readDatagrams(int aBlockSize) throws org.refcodes.component.OpenException, InterruptedException
readDatagrams()
though at maximum the amount of data
as provided by the block-size is returned.aBlockSize
- The block-size which is not to exceeded by the returned
data. A value of -1 specifies to retrieve all available datagrams
(same behavior as method readDatagrams()
.BlockSender
or
DatagramReceiver
counterpart.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.InterruptedException
- Thrown when a Thread
is waiting,
sleeping, or otherwise occupied, and the Thread
is
interrupted, either before or during the activity.Copyright © 2017. All rights reserved.