Package org.refcodes.io
Interface Provider<DATA extends java.io.Serializable>
-
- Type Parameters:
DATA- the generic type
- All Superinterfaces:
BlockProvider<DATA>,DatagramProvider<DATA>
- All Known Subinterfaces:
BidirectionalConnectionTransceiver<DATA,INPUT,OUTPUT>,BidirectionalStreamConnectionTransceiver<DATA>,ConnectionReceiver<DATA,CON>,ConnectionTransceiver<DATA,CON>,InputStreamConnectionReceiver<DATA>,LoopbackReceiver<DATA>,LoopbackTransceiver<DATA>,Receiver<DATA>,Transceiver<DATA>
- All Known Implementing Classes:
AbstractInputStreamReceiver,AbstractPrefetchInputStreamReceiver,AbstractReceiver,BidirectionalStreamConnectionTransceiverImpl,BidirectionalStreamTransceiverImpl,InputStreamConnectionReceiverImpl,InputStreamReceiverImpl,LoopbackReceiverImpl,LoopbackTransceiverImpl,PrefetchBidirectionalStreamConnectionTransceiverImpl,PrefetchBidirectionalStreamTransceiverImpl,PrefetchInputStreamConnectionReceiverImpl,PrefetchInputStreamReceiverImpl,ReceiverDecorator
- 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 Provider<DATA extends java.io.Serializable> extends DatagramProvider<DATA>, BlockProvider<DATA>
The Interface Provider.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default DATA[]readDatagrams()Caution: Reads till anOpenException(or anInterruptedExceptionin case of blocking till more data is available) occurs.default DATA[]readDatagrams(int aBlockSize)Similar toBlockProvider.readDatagrams()though at maximum the amount of data as provided by the block-size is returned.-
Methods inherited from interface org.refcodes.io.DatagramProvider
readDatagram
-
-
-
-
Method Detail
-
readDatagrams
default DATA[] readDatagrams() throws org.refcodes.component.OpenException, java.lang.InterruptedException
Caution: Reads till anOpenException(or anInterruptedExceptionin case of blocking till more data is available) occurs. Reads (receives) the next datagram block passed from aBlockSenderorDatagramSendercounterpart. In case none datagram block is available, then this method blocks until one is available. When aThreadis waiting for a datagram to be read andThread.interrupt()is being called, then the operation is aborted and anInterruptedExceptionis thrown.- Specified by:
readDatagramsin interfaceBlockProvider<DATA extends java.io.Serializable>- Returns:
- The next datagram block sent from the
BlockSenderorDatagramReceivercounterpart. - 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.
-
readDatagrams
default DATA[] readDatagrams(int aBlockSize) throws org.refcodes.component.OpenException, java.lang.InterruptedException
Description copied from interface:BlockProviderSimilar toBlockProvider.readDatagrams()though at maximum the amount of data as provided by the block-size is returned.- Specified by:
readDatagramsin interfaceBlockProvider<DATA extends java.io.Serializable>- Parameters:
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 methodBlockProvider.readDatagrams().- Returns:
- The next short block sent from the
BlockSenderorDatagramReceivercounterpart. - 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.
-
-