- 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
Modifier and TypeInterfaceDescriptionstatic class
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
Modifier and TypeMethodDescriptiondefault InputStream
Retrieves the input stream from the underlying implementation as is (noTimeoutInputStream
wrapping the originalInputStream
).default TimeoutInputStream
getInputStream
(long aTimeoutMillis) Retrieves theInputStream
as provided bygetInputStream()
wrapped in aTimeoutInputStream
or an implementation depended implementation of aTimeoutInputStream
.default byte[]
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 aTimeoutMillis, 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 aTimeoutMillis, int aLength) Receives a byte array with the number of bytes specified.default byte
receiveByteWithin
(long aTimeoutMillis) Receives a byte.default long
skip
(long aLength) Skips over and discardsn
bytes of data from this input stream.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.Closable.CloseAutomaton
isClosable
Methods inherited from interface org.refcodes.component.ClosedAccessor
isClosed
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, skipAvailableWithin
-
Method Details
-
skip
Skips over and discardsn
bytes of data from this input stream. Theskip
method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly0
. This may result from any of a number of conditions; reaching end of file beforen
bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. Ifn
is negative, theskip
method for classInputStream
always returns 0, and no bytes are skipped. Subclasses may handle the negative value differently. Theskip
method implementation of this class creates a byte array and then repeatedly reads into it untiln
bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method. For instance, the implementation may depend on the ability to seek.- Specified by:
skip
in interfaceSkippable
- Parameters:
aLength
- the number of bytes to be skipped.- Returns:
- the actual number of bytes skipped which might be zero.
- Throws:
IOException
- if an I/O error occurs.
-
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
Retrieves theInputStream
as provided bygetInputStream()
wrapped in aTimeoutInputStream
or an implementation depended implementation of aTimeoutInputStream
.- Specified by:
getInputStream
in interfaceTimeoutInputStreamAccessor
- Parameters:
aTimeoutMillis
- the a timeout in ms- Returns:
- The according
TimeoutInputStream
from the underlyingInputStream
.
-
receiveAllBytes
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
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
Receives a byte. This method blocks till a byte is available or the timeout has been reached.- Parameters:
aTimeoutMillis
- 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
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:
aTimeoutMillis
- 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 aTimeoutMillis, 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:
aTimeoutMillis
- 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.
-