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>
-
- All Implemented Interfaces:
Serializable
,org.refcodes.mixin.DecorateeAccessor<DECORATEE>
,org.refcodes.mixin.LengthAccessor
,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>
TheAbstractLengthDecoratorSegment
decorates a decoratee with a length prefix.- See Also:
- Serialized Form
-
-
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, LENGTH_ENDIANESS, LENGTH_WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLengthDecoratorSegment()
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DECORATEE
getDecoratee()
int
getLength()
Determines the overall length of thisTransmission
.Schema
toSchema()
Retrieves theSchema
representing theTransmission
.Sequence
toSequence()
Provides theSequence
representation of thisTransmission
.String
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 Detail
-
AbstractLengthDecoratorSegment
protected AbstractLengthDecoratorSegment(TransmissionMetrics aTransmissionMetrics)
-
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
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee)
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, org.refcodes.numerical.Endianess aEndianess)
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, int aLengthWidth)
-
AbstractLengthDecoratorSegment
public AbstractLengthDecoratorSegment(DECORATEE aDecoratee, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
-
-
Method Detail
-
toSequence
public Sequence 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
public void transmitTo(OutputStream aOutputStream, InputStream aReturnStream) throws IOException
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
public DECORATEE getDecoratee()
- Specified by:
getDecoratee
in interfaceorg.refcodes.mixin.DecorateeAccessor<DECORATEE extends Transmission>
-
toSchema
public Schema toSchema()
Retrieves theSchema
representing theTransmission
. Retrieving aSchema
is useful when analyzing and debugging data structures such as aAllocSectionDecoratorSegment
instance to help document, learn and verify on the structure (as well as the content) of that veryAllocSectionDecoratorSegment
.- Specified by:
toSchema
in interfaceTransmission
- Overrides:
toSchema
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
- Returns:
- The
Schema
representation of the implementing type for debugging and verification (or documentation) purposes.
-
toString
public String toString()
- Overrides:
toString
in classAbstractReferenceeLengthSegment<DECORATEE extends Transmission>
-
-