Interface ShortsDestination

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
The ShortsDestination is used to receive short blocks (arrays) in a unified way. The receiveAllShorts() method provides the next available short block from the counterpart DatagramsTransmitter or DatagramTransmitter; in case there is none available, then this method halts until one is available.
  • Method Summary

    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 to receiveAllShorts() 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 Details

    • receiveShort

      short receiveShort() throws IOException
      Reads (receives) the next short available, in case none short is available, then this method blocks until one is available.
      Specified by:
      receiveShort in interface ShortDestination
      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.
    • receiveAllShorts

      default short[] receiveAllShorts() throws IOException
      Reads (receives) the all currently available data.
      Returns:
      The next short block sent from the DatagramsTransmitter or DatagramReceiver counterpart.
      Throws:
      IOException - Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
    • receiveShorts

      default short[] receiveShorts​(int aMaxLength) throws IOException
      Similar to receiveAllShorts() 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 method receiveAllShorts().
      Returns:
      The next short block sent from the DatagramsTransmitter or DatagramReceiver counterpart.
      Throws:
      IOException - Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
    • receiveShorts

      default void receiveShorts​(short[] aBuffer, int aOffset, int aLength) throws IOException
      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.