Package org.refcodes.io
Interface ShortDatagramProvider
-
- All Known Subinterfaces:
ConnectionShortReceiver<CON>,ConnectionShortTransceiver<CON>,LoopbackShortReceiver,LoopbackShortTransceiver,ShortDatagramReceiver,ShortProvider,ShortReceiver,ShortTransceiver
- All Known Implementing Classes:
AbstractShortReceiver,LoopbackShortReceiverImpl,LoopbackShortTransceiverImpl,ShortArrayReceiverImpl,ShortReceiverDecorator
- 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 ShortDatagramProviderTheShortDatagramProvideris used to receive shorts in a unified way. ThereadDatagram()method provides the next available short 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 shortreadDatagram()Reads (receives) the next short passed from aDatagramSendercounterpart.
-
-
-
Method Detail
-
readDatagram
short readDatagram() throws org.refcodes.component.OpenException, java.lang.InterruptedExceptionReads (receives) the next short passed from aDatagramSendercounterpart. In case none short is available, then this method blocks until one is available. To prevent blocking, use theShortDatagramReceiverextension'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 aThreadis waiting for a short to be read andThread.interrupt()is being called, then the operation is aborted and anInterruptedExceptionis thrown.- Returns:
- The next short sent from the
ShortDatagramSendercounterpart. - Throws:
org.refcodes.component.OpenException- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.java.lang.InterruptedException- Thrown when aThreadis waiting, sleeping, or otherwise occupied, and theThreadis interrupted, either before or during the activity.
-
-