Module org.refcodes.serial
Package org.refcodes.serial
Class AbstractLengthDecoratorSegment<DECORATEE extends Transmission>
java.lang.Object
org.refcodes.serial.AbstractReferenceeLengthSegment<DECORATEE>
org.refcodes.serial.AbstractLengthDecoratorSegment<DECORATEE>
- Type Parameters:
DECORATEE- the generic type
- All Implemented Interfaces:
Serializable,org.refcodes.mixin.DecorateeAccessor<DECORATEE>,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.Resetable,org.refcodes.numerical.EndianessAccessor,org.refcodes.schema.Schemable,AllocLengthAccessor,DecoratorSegment<DECORATEE>,LengthWidthAccessor,Segment,Transmission,Transmission.TransmissionMixin
- Direct Known Subclasses:
AllocSectionDecoratorSegment,LengthSegmentDecoratorSegment
public abstract class AbstractLengthDecoratorSegment<DECORATEE extends Transmission>
extends AbstractReferenceeLengthSegment<DECORATEE>
implements DecoratorSegment<DECORATEE>
The
AbstractLengthDecoratorSegment decorates a decoratee with a
length prefix.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.serial.AllocLengthAccessor
AllocLengthAccessor.AllocLengthBuilder<B extends AllocLengthAccessor.AllocLengthBuilder<B>>, AllocLengthAccessor.AllocLengthMutator, AllocLengthAccessor.AllocLengthPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.DecorateeAccessor
org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE extends Object,B extends org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE, B>>, org.refcodes.mixin.DecorateeAccessor.DecorateeMutator<DECORATEE extends Object>, org.refcodes.mixin.DecorateeAccessor.DecorateeProperty<DECORATEE extends Object> Nested classes/interfaces inherited from interface org.refcodes.numerical.EndianessAccessor
org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B extends org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B>>, org.refcodes.numerical.EndianessAccessor.EndianessMutator, org.refcodes.numerical.EndianessAccessor.EndianessPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface org.refcodes.serial.LengthWidthAccessor
LengthWidthAccessor.LengthWidthBuilder<B extends LengthWidthAccessor.LengthWidthBuilder<B>>, LengthWidthAccessor.LengthWidthMutator, LengthWidthAccessor.LengthWidthPropertyNested classes/interfaces inherited from interface org.refcodes.serial.Segment
Segment.SegmentMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Field Summary
Fields inherited from class org.refcodes.serial.AbstractReferenceeLengthSegment
_allocLength, _endianess, _lengthWidth, _referencee, ALLOC_LENGTH, ALLOC_LENGTH_WIDTH, ENDIANESS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractLengthDecoratorSegment(int aLengthWidth) protectedAbstractLengthDecoratorSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess) AbstractLengthDecoratorSegment(DECORATEE aDecoratee) AbstractLengthDecoratorSegment(DECORATEE aDecoratee, int aLengthWidth) AbstractLengthDecoratorSegment(DECORATEE aDecoratee, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess) AbstractLengthDecoratorSegment(DECORATEE aDecoratee, org.refcodes.numerical.Endianess aEndianess) AbstractLengthDecoratorSegment(DECORATEE aDecoratee, TransmissionMetrics aTransmissionMetrics) protectedAbstractLengthDecoratorSegment(org.refcodes.numerical.Endianess aEndianess) protectedAbstractLengthDecoratorSegment(TransmissionMetrics aTransmissionMetrics) -
Method Summary
Modifier and TypeMethodDescriptionintDetermines the overall length of thisTransmission.toSchema()Provides theSequencerepresentation of thisTransmission.toString()voidtransmitTo(OutputStream aOutputStream, InputStream aReturnStream) Transmits theSequencerepresenting the implementing type's instance to the givenOutputStream.Methods inherited from class org.refcodes.serial.AbstractReferenceeLengthSegment
equals, fromTransmission, getAllocLength, getEndianess, getLengthWidth, hashCode, receiveFrom, reset, toSimpleTypeMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
reset, toSimpleTypeMap, transmitTo, transmitTo
-
Constructor Details
-
AbstractLengthDecoratorSegment
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, TransmissionMetrics aTransmissionMetrics) -
AbstractLengthDecoratorSegment
protected AbstractLengthDecoratorSegment() -
AbstractLengthDecoratorSegment
protected AbstractLengthDecoratorSegment(org.refcodes.numerical.Endianess aEndianess) -
AbstractLengthDecoratorSegment
protected AbstractLengthDecoratorSegment(int aLengthWidth) -
AbstractLengthDecoratorSegment
protected AbstractLengthDecoratorSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess) -
AbstractLengthDecoratorSegment
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, org.refcodes.numerical.Endianess aEndianess) -
AbstractLengthDecoratorSegment
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
-
-
Method Details
-
toSequence
Provides theSequencerepresentation of thisTransmission. In case of nestedTransmissioninstances, allSequencerepresentations from all sub-segments are accumulated to the result as well. Caution, the Transmission (or its nestedTransmissioninstances) may be backed by the returnedSequence.- Specified by:
toSequencein interfaceTransmission- Overrides:
toSequencein classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>- Returns:
- The according instance's
Sequence.
-
transmitTo
Transmits theSequencerepresenting the implementing type's instance to the givenOutputStream. Implementations providing error correction methods use the provided feedbackInputStreamto do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the transmitted data.- Specified by:
transmitToin interfaceTransmission- Specified by:
transmitToin interfaceTransmission.TransmissionMixin- Parameters:
aOutputStream- TheOutputStreamwhere to write this instance'sSequenceto.aReturnStream- AnInputStreambeing the return channel to handle "stop-and-wait ARQ" or the like in case of a bidirectional connection. Can be null in case we have a unidirectional connection.- Throws:
IOException- thrown in case writing data to theOutputStreamcaused problems.
-
getLength
public int getLength()Determines the overall length of thisTransmission. In case of nestedTransmissioninstances, all length values from all sub-segments are accumulated to the result as well.- Specified by:
getLengthin interfaceorg.refcodes.mixin.LengthAccessor- Specified by:
getLengthin interfaceTransmission- Overrides:
getLengthin classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>- Returns:
- The (overall) length of the
Transmission(including any sub-segments).
-
getDecoratee
- Specified by:
getDecorateein interfaceorg.refcodes.mixin.DecorateeAccessor<DECORATEE extends Transmission>
-
toSchema
- Specified by:
toSchemain interfaceorg.refcodes.schema.Schemable- Specified by:
toSchemain interfaceTransmission- Overrides:
toSchemain classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
-
toString
- Overrides:
toStringin classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
-