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.Schemable
,org.refcodes.numerical.EndianessAccessor
,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.AllocLengthProperty
Nested 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.EndianessProperty
Nested 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.LengthProperty
Nested classes/interfaces inherited from interface org.refcodes.serial.LengthWidthAccessor
LengthWidthAccessor.LengthWidthBuilder<B extends LengthWidthAccessor.LengthWidthBuilder<B>>, LengthWidthAccessor.LengthWidthMutator, LengthWidthAccessor.LengthWidthProperty
Nested classes/interfaces inherited from interface org.refcodes.serial.Segment
Segment.SegmentMixin
Nested 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
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractLengthDecoratorSegment
(int aLengthWidth) protected
AbstractLengthDecoratorSegment
(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) protected
AbstractLengthDecoratorSegment
(org.refcodes.numerical.Endianess aEndianess) protected
AbstractLengthDecoratorSegment
(TransmissionMetrics aTransmissionMetrics) -
Method Summary
Modifier and TypeMethodDescriptionint
Determines the overall length of thisTransmission
.toSchema()
Provides theSequence
representation of thisTransmission
.toString()
void
transmitTo
(OutputStream aOutputStream, InputStream aReturnStream) Transmits theSequence
representing the implementing type's instance to the givenOutputStream
.Methods inherited from class org.refcodes.serial.AbstractReferenceeLengthSegment
equals, fromTransmission, getAllocLength, getEndianess, getLengthWidth, hashCode, receiveFrom, toSimpleTypeMap
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFrom, receiveFrom
Methods inherited from interface org.refcodes.serial.Transmission
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 theSequence
representation of thisTransmission
. In case of nestedTransmission
instances, allSequence
representations from all sub-segments are accumulated to the result as well. Caution, the Transmission (or its nestedTransmission
instances) may be backed by the returnedSequence
.- Specified by:
toSequence
in interfaceTransmission
- Overrides:
toSequence
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
- Returns:
- The according instance's
Sequence
.
-
transmitTo
Transmits theSequence
representing the implementing type's instance to the givenOutputStream
. Implementations providing error correction methods use the provided feedbackInputStream
to do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the transmitted data.- Specified by:
transmitTo
in interfaceTransmission
- Specified by:
transmitTo
in interfaceTransmission.TransmissionMixin
- Parameters:
aOutputStream
- TheOutputStream
where to write this instance'sSequence
to.aReturnStream
- AnInputStream
being 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 theOutputStream
caused problems.
-
getLength
public int getLength()Determines the overall length of thisTransmission
. In case of nestedTransmission
instances, all length values from all sub-segments are accumulated to the result as well.- Specified by:
getLength
in interfaceorg.refcodes.mixin.LengthAccessor
- Specified by:
getLength
in interfaceTransmission
- Overrides:
getLength
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
- Returns:
- The (overall) length of the
Transmission
(including any sub-segments).
-
getDecoratee
- Specified by:
getDecoratee
in interfaceorg.refcodes.mixin.DecorateeAccessor<DECORATEE extends Transmission>
-
toSchema
- Specified by:
toSchema
in interfaceorg.refcodes.mixin.Schemable
- Specified by:
toSchema
in interfaceTransmission
- Overrides:
toSchema
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
-
toString
- Overrides:
toString
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
-