Class MagicBytesSegmentMultiplexer

All Implemented Interfaces:
Serializable, Iterable<Segment>, org.refcodes.mixin.ChildrenAccessor<Segment[]>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.Schemable, Segment, Transmission

public class MagicBytesSegmentMultiplexer extends AbstractMagicBytesTransmissionMultiplexer<Segment> implements Segment
THe MagicBytesSegmentMultiplexer dispatches a transmission to one of the aggregated Segment instances depending on the magic number provided by the transmission. A transmission is passed to each of the aggregated Segment instances till one Segment accepts the transmission, e.g. until a Segment does not throw a BadMagicBytesException. To enforce throwing a BadMagicBytesException use a magic bytes Segment or Section which enforces the magic bytes to of a transmission to match its own magic bytes, e.e. use one of the following: AssertMagicBytesSectionDecorator, AssertMagicBytesSegment, AssertMagicBytesSegmentDecorator Attention: A Segment throwing a TransmissionException other than a BadMagicBytesException is considered to be responsible for the transmission so that dispatching is *not* continued with the succeeding Segment! The last Segment which was responsible for a transmission's magic bytes will be the responsible Segment till another Segment claims responsibility for a transmsision's magic bytes. Initially the first Segment passed to this instance is the responsible Segment.
See Also: