- All Superinterfaces:
ByteDestination
- All Known Subinterfaces:
BidirectionalConnectionByteTransceiver<INPUT,
,OUTPUT> BidirectionalStreamConnectionByteTransceiver
,BytesReceiver
,BytesTransceiver
,ConnectionBytesReceiver<CON>
,ConnectionBytesTransceiver<CON>
,InputStreamConnectionByteReceiver
- All Known Implementing Classes:
AbstractBytesDestination
,AbstractBytesReceiver
,AbstractInputStreamByteReceiver
,AbstractPrefetchInputStreamByteReceiver
,BidirectionalStreamByteTransceiver
,BidirectionalStreamConnectionByteTransceiverImpl
,ByteArrayReceiver
,BytesReceiverDecorator
,InputStreamByteReceiver
,InputStreamConnectionByteReceiverImpl
,LoopbackBytesReceiver
,LoopbackBytesTransceiver
,PrefetchBidirectionalStreamByteTransceiver
,PrefetchBidirectionalStreamConnectionByteTransceiver
,PrefetchInputStreamByteReceiver
,PrefetchInputStreamConnectionByteReceiver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The
BytesDestination
is used to receive byte blocks (arrays) in a
unified way. The receiveAllBytes()
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 TypeMethodDescriptiondefault byte[]
Reads (receives) the all currently available data.byte
Reads (receives) the next byte, in case none byte is available, then this method blocks until one is available.default void
receiveBytes
(byte[] aBuffer, int aOffset, int aLength) Receives a byte array with the number of bytes specified inserted at the given offset.default byte[]
receiveBytes
(int aMaxLength) Similar toreceiveAllBytes()
though at maximum the amount of data as of the provided length returned.
-
Method Details
-
receiveByte
Reads (receives) the next byte, in case none byte is available, then this method blocks until one is available.- Specified by:
receiveByte
in interfaceByteDestination
- Returns:
- The next byte available .
- 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.
-
receiveAllBytes
Reads (receives) the all currently available data.- Returns:
- The according data.
- 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.
-
receiveBytes
Similar toreceiveAllBytes()
though at maximum the amount of data as of the provided length 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 methodreceiveAllBytes()
.- Returns:
- The according data.
- 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.
-
receiveBytes
default void receiveBytes(byte[] aBuffer, int aOffset, int aLength) throws IOException, EOFException Receives a byte array with the number of bytes specified inserted at the given offset. This method blocks till a byte is available.- Parameters:
aBuffer
- The byte array where to store the bytes at.aOffset
- The offset where to start storing the received bytes.aLength
- The number of bytes 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.
-