Class BytesReceiverDecorator

All Implemented Interfaces:
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.component.OpenedAccessor, Availability, ByteDestination, ByteReceiver, BytesDestination, BytesReceiver, Receivable, Skippable, TimeoutInputStreamAccessor, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.Loggable

public class BytesReceiverDecorator extends AbstractBytesReceiver implements BytesReceiver
The BytesReceiverDecorator decorates a BytesDestination with the additional methods of a BytesReceiver making it easy to use a BytesDestination wherever a BytesReceiver is expected. This is a very plain implementation: available() always returns true if AbstractBytesReceiver.isOpened() is true and as long as none of the receiveByte(), receiveAllBytes() or receiveBytes(int) methods threw an IOException ( InterruptedException). This implementation actually behaves as if close() has been called after verifying available() and before any of the read methods have been called.