-
- All Superinterfaces:
ShortDestination
- All Known Subinterfaces:
ConnectionShortsReceiver<CON>
,ConnectionShortsTransceiver<CON>
,ShortsReceiver
,ShortsTransceiver
- All Known Implementing Classes:
AbstractShortsDestination
,AbstractShortsReceiver
,LoopbackShortsReceiver
,LoopbackShortsTransceiver
,ShortArrayReceiver
,ShortsReceiverDecorator
- 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 ShortsDestination extends ShortDestination
TheShortsDestination
is used to receive short blocks (arrays) in a unified way. ThereceiveAllShorts()
method provides the next available short block from the counterpartDatagramsTransmitter
orDatagramTransmitter
; 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 short[]
receiveAllShorts()
Reads (receives) the all currently available data.short
receiveShort()
Reads (receives) the next short available, in case none short is available, then this method blocks until one is available.default short[]
receiveShorts(int aMaxLength)
Similar toreceiveAllShorts()
though at maximum the amount of data as provided returned.default void
receiveShorts(short[] aBuffer, int aOffset, int aLength)
Receives a short array with the number of bytes specified inserted at the given offset.
-
-
-
Method Detail
-
receiveShort
short receiveShort() throws IOException, EOFException
Reads (receives) the next short available, in case none short is available, then this method blocks until one is available.- Specified by:
receiveShort
in interfaceShortDestination
- Returns:
- The next short sent from the
ShortsTransmitter
counterpart. - Throws:
IOException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.EOFException
- Signals that an end of file or end of stream has been reached unexpectedly during input.
-
receiveAllShorts
default short[] receiveAllShorts() throws IOException, EOFException
Reads (receives) the all currently available data.- Returns:
- The next short block sent from the
DatagramsTransmitter
orDatagramReceiver
counterpart. - Throws:
IOException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.EOFException
- Signals that an end of file or end of stream has been reached unexpectedly during input.
-
receiveShorts
default short[] receiveShorts(int aMaxLength) throws IOException, EOFException
Similar toreceiveAllShorts()
though at maximum the amount of data as provided returned.- Parameters:
aMaxLength
- 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 methodreceiveAllShorts()
.- Returns:
- The next short block sent from the
DatagramsTransmitter
orDatagramReceiver
counterpart. - Throws:
IOException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.EOFException
- Signals that an end of file or end of stream has been reached unexpectedly during input.
-
receiveShorts
default void receiveShorts(short[] aBuffer, int aOffset, int aLength) throws IOException, EOFException
Receives a short array with the number of bytes specified inserted at the given offset. This method blocks till a byte is available.- Parameters:
aBuffer
- The short array where to store the shorts at.aOffset
- The offset where to start storing the received shorts.aLength
- The number of shorts to receive.- Throws:
IOException
- thrown in case of I/O issues (e.g. a timeout) while receiving.EOFException
- Signals that an end of file or end of stream has been reached unexpectedly during input.
-
-