Package org.refcodes.io
Interface ByteBlockProvider
-
- All Known Subinterfaces:
BidirectionalConnectionByteTransceiver<INPUT,OUTPUT>
,BidirectionalStreamConnectionByteTransceiver
,ByteArrayProvider
,ByteArrayReceiver
,ByteBlockReceiver
,ByteBlockTransceiver
,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 ByteBlockProvider
TheByteBlockProvider
is used to receive byte blocks (arrays) in a unified way. ThereadDatagrams()
method provides the next available byte block from the counterpartBlockSender
orDatagramSender
; in case there is none available, then this method halts until one is available.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default byte[]
readDatagrams()
Reads (receives) the next byte block passed from aBlockSender
orDatagramSender
counterpart.byte[]
readDatagrams(int aBlockSize)
Similar toreadDatagrams()
though at maximum the amount of data as provided by the block-size is returned.
-
-
-
Method Detail
-
readDatagrams
default byte[] readDatagrams() throws org.refcodes.component.OpenException, java.lang.InterruptedException
Reads (receives) the next byte block passed from aBlockSender
orDatagramSender
counterpart. In case none byte block is available, then this method blocks until one is available. 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 block sent from the
BlockSender
orDatagramReceiver
counterpart. - Throws:
org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.java.lang.InterruptedException
- Thrown when aThread
is waiting, sleeping, or otherwise occupied, and theThread
is interrupted, either before or during the activity.
-
readDatagrams
byte[] readDatagrams(int aBlockSize) throws org.refcodes.component.OpenException, java.lang.InterruptedException
Similar toreadDatagrams()
though at maximum the amount of data as provided by the block-size is returned.- 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 methodreadDatagrams()
.- Returns:
- The next short block sent from the
BlockSender
orDatagramReceiver
counterpart. - Throws:
org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.java.lang.InterruptedException
- Thrown when aThread
is waiting, sleeping, or otherwise occupied, and theThread
is interrupted, either before or during the activity.
-
-