Package org.refcodes.io
Interface ByteDatagramProvider
-
- All Known Subinterfaces:
BidirectionalConnectionByteTransceiver<INPUT,OUTPUT>
,BidirectionalStreamConnectionByteTransceiver
,ByteArrayProvider
,ByteArrayReceiver
,ByteDatagramReceiver
,ByteDatagramTransceiver
,ByteProvider
,ByteReceiver
,ByteTransceiver
,ConnectionByteReceiver<CON>
,ConnectionByteTransceiver<CON>
,InputStreamConnectionByteReceiver
,LoopbackByteReceiver
,LoopbackByteTransceiver
- All Known Implementing Classes:
AbstractByteProvider
,AbstractByteReceiver
,AbstractInputStreamByteReceiver
,AbstractPrefetchInputStreamByteReceiver
,BidirectionalStreamByteTransceiverImpl
,BidirectionalStreamConnectionByteTransceiverImpl
,ByteArrayProviderImpl
,ByteArrayReceiverImpl
,ByteReceiverDecorator
,InputStreamByteReceiverImpl
,InputStreamConnectionByteReceiverImpl
,LoopbackByteReceiverImpl
,LoopbackByteTransceiverImpl
,PrefetchBidirectionalStreamByteTransceiverImpl
,PrefetchBidirectionalStreamConnectionByteTransceiverImpl
,PrefetchInputStreamByteReceiverImpl
,PrefetchInputStreamConnectionByteReceiverImpl
- 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 ByteDatagramProvider
TheByteDatagramProvider
is used to receive bytes in a unified way. ThereadDatagram()
method provides the next available byte from the counterpartDatagramSender
; in case there is none available, then this method halts until one is available.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte
readDatagram()
Reads (receives) the next byte passed from aDatagramSender
counterpart.
-
-
-
Method Detail
-
readDatagram
byte readDatagram() throws org.refcodes.component.OpenException, InterruptedException
Reads (receives) the next byte passed from aDatagramSender
counterpart. In case none byte is available, then this method blocks until one is available. To prevent blocking, use theByteDatagramReceiver
extension'sReceivable.hasDatagram()
method to test beforehand whether a byte is available (in a multi-threaded usage scenario,Receivable.hasDatagram()
is not a reliable indicator whether this method will block or not). When aThread
is waiting for a byte to be read andThread.interrupt()
is being called, then the operation is aborted and anInterruptedException
is thrown.- Returns:
- The next byte sent from the
ByteDatagramSender
counterpart. - Throws:
org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.InterruptedException
- Thrown when aThread
is waiting, sleeping, or otherwise occupied, and theThread
is interrupted, either before or during the activity.
-
-