-
- All Superinterfaces:
Availability
,ByteDestination
,ByteReceiver
,BytesDestination
,org.refcodes.component.Closable
,org.refcodes.component.Closable.CloseAutomaton
,org.refcodes.component.ClosedAccessor
,org.refcodes.component.ConnectableComponent
,org.refcodes.component.ConnectableComponent.ConnectableAutomaton
,org.refcodes.component.ConnectionStatusAccessor
,org.refcodes.mixin.InputStreamAccessor
,org.refcodes.component.OpenedAccessor
,Receivable
,Skippable
,TimeoutInputStreamAccessor
- All Known Subinterfaces:
BidirectionalConnectionByteTransceiver<INPUT,OUTPUT>
,BidirectionalStreamConnectionByteTransceiver
,BytesTransceiver
,ConnectionBytesReceiver<CON>
,ConnectionBytesTransceiver<CON>
,InputStreamConnectionByteReceiver
- All Known Implementing Classes:
AbstractBytesReceiver
,AbstractInputStreamByteReceiver
,AbstractPrefetchInputStreamByteReceiver
,BidirectionalStreamByteTransceiver
,BidirectionalStreamConnectionByteTransceiverImpl
,ByteArrayReceiver
,BytesReceiverDecorator
,InputStreamByteReceiver
,InputStreamConnectionByteReceiverImpl
,LoopbackBytesReceiver
,LoopbackBytesTransceiver
,PrefetchBidirectionalStreamByteTransceiver
,PrefetchBidirectionalStreamConnectionByteTransceiver
,PrefetchInputStreamByteReceiver
,PrefetchInputStreamConnectionByteReceiver
public interface BytesReceiver extends BytesDestination, ByteReceiver, TimeoutInputStreamAccessor, Skippable
The Interface BytesReceiver.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BytesReceiver.ReceiverInputStream
-
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.InputStreamAccessor
org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<B extends org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<?>>, org.refcodes.mixin.InputStreamAccessor.InputStreamMutator, org.refcodes.mixin.InputStreamAccessor.InputStreamProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.io.TimeoutInputStreamAccessor
TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<B extends TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<?>>, TimeoutInputStreamAccessor.TimeoutInputStreamMutator, TimeoutInputStreamAccessor.TimeoutInputStreamProperty
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default InputStream
getInputStream()
Retrieves the input stream from the underlying implementation as is (noTimeoutInputStream
wrapping the originalInputStream
).default TimeoutInputStream
getInputStream(long aTimeoutInMs)
Retrieves theInputStream
as provided bygetInputStream()
wrapped in aTimeoutInputStream
or an implementation depended implementation of aTimeoutInputStream
.default byte[]
receiveAllBytes()
Reads (receives) the all currently available data.default byte[]
receiveBytes(int aMaxLength)
Similar toBytesDestination.receiveAllBytes()
though at maximum the amount of data as of the provided length returned.default void
receiveBytesWithin(long aTimeoutInMs, byte[] aBuffer, int aOffset, int aLength)
Receives a byte array with the number of bytes specified inserted at the given offset.default byte[]
receiveBytesWithin(long aTimeoutInMs, int aLength)
Receives a byte array with the number of bytes specified.default byte
receiveByteWithin(long aTimeoutInMs)
Receives a byte.default long
skip(long aLength)
-
Methods inherited from interface org.refcodes.io.Availability
available, hasAvailable
-
Methods inherited from interface org.refcodes.io.BytesDestination
receiveByte, receiveBytes
-
Methods inherited from interface org.refcodes.component.Closable
close, closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isOpened
-
Methods inherited from interface org.refcodes.io.Skippable
available, skipAvailable, skipAvailableExcept, skipAvailableTill, skipAvailableTillSilenceFor, skipAvailableTillSilenceFor, skipAvailableWithin, skipAvailableWithin
-
-
-
-
Method Detail
-
skip
default long skip(long aLength) throws IOException
- Specified by:
skip
in interfaceSkippable
- Throws:
IOException
-
getInputStream
default InputStream getInputStream()
Retrieves the input stream from the underlying implementation as is (noTimeoutInputStream
wrapping the originalInputStream
).- Specified by:
getInputStream
in interfaceorg.refcodes.mixin.InputStreamAccessor
- Returns:
- The according underlying
InputStream
.
-
getInputStream
default TimeoutInputStream getInputStream(long aTimeoutInMs)
Retrieves theInputStream
as provided bygetInputStream()
wrapped in aTimeoutInputStream
or an implementation depended implementation of aTimeoutInputStream
.- Specified by:
getInputStream
in interfaceTimeoutInputStreamAccessor
- Parameters:
aTimeoutInMs
- the a timeout in ms- Returns:
- The according
TimeoutInputStream
from the underlyingInputStream
.
-
receiveAllBytes
default byte[] receiveAllBytes() throws IOException
Reads (receives) the all currently available data.- Specified by:
receiveAllBytes
in interfaceBytesDestination
- 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 byte[] receiveBytes(int aMaxLength) throws IOException
Similar toBytesDestination.receiveAllBytes()
though at maximum the amount of data as of the provided length returned.- Specified by:
receiveBytes
in interfaceBytesDestination
- 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 methodBytesDestination.receiveAllBytes()
.- 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.
-
receiveByteWithin
default byte receiveByteWithin(long aTimeoutInMs) throws IOException
Receives a byte. This method blocks till a byte is available or the timeout has been reached.- Parameters:
aTimeoutInMs
- The default timeout for read operations not explicitly called with a timeout argument. With a value of -1 timeout handling is disabled (blocking mode) or a technical timeout occurs (implementation depended).- Returns:
- A accordingly received byte.
- Throws:
IOException
- thrown in case of I/O issues (e.g. a timeout) while receiving.
-
receiveBytesWithin
default byte[] receiveBytesWithin(long aTimeoutInMs, int aLength) throws IOException
Receives a byte array with the number of bytes specified. This method blocks till all bytes are read or the timeout has been reached.- Parameters:
aTimeoutInMs
- The default timeout for read operations not explicitly called with a timeout argument. With a value of -1 timeout handling is disabled (blocking mode) or a technical timeout occurs (implementation depended).aLength
- The number of bytes to receive.- Returns:
- A byte array containing the accordingly received bytes.
- Throws:
IOException
- thrown in case of I/O issues (e.g. a timeout) while receiving.
-
receiveBytesWithin
default void receiveBytesWithin(long aTimeoutInMs, byte[] aBuffer, int aOffset, int aLength) throws IOException
Receives a byte array with the number of bytes specified inserted at the given offset. This method blocks till all bytes are read or the timeout has been reached.- Parameters:
aTimeoutInMs
- The default timeout for read operations not explicitly called with a timeout argument. With a value of -1 timeout handling is disabled (blocking mode) or a technical timeout occurs (implementation depended).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.
-
-