Serializable
, org.refcodes.mixin.LengthAccessor
, org.refcodes.numerical.EndianessAccessor
, AllocLengthAccessor
, LengthWidthAccessor
, Segment
, Transmission
, Transmission.TransmissionMixin
AbstractLengthDecoratorSegment
, AllocSegmentHead
, LengthDecoratorSegment
public abstract class AbstractReferenceeLengthSegment<REFERENCEE extends Transmission> extends Object implements Segment, Transmission.TransmissionMixin, LengthWidthAccessor, org.refcodes.numerical.EndianessAccessor, AllocLengthAccessor
AbstractReferenceeLengthSegment
represents a allocated length
value as of the referenced Transmission
element's length.AllocLengthAccessor.AllocLengthBuilder<B extends AllocLengthAccessor.AllocLengthBuilder<B>>, AllocLengthAccessor.AllocLengthMutator, AllocLengthAccessor.AllocLengthProperty
org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B extends org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B>>, org.refcodes.numerical.EndianessAccessor.EndianessMutator, org.refcodes.numerical.EndianessAccessor.EndianessProperty
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthProperty
LengthWidthAccessor.LengthWidthBuilder<B extends LengthWidthAccessor.LengthWidthBuilder<B>>, LengthWidthAccessor.LengthWidthMutator, LengthWidthAccessor.LengthWidthProperty
Segment.SegmentMixin
Transmission.TransmissionMixin
Modifier and Type | Field | Description |
---|---|---|
protected int |
_allocLength |
|
protected org.refcodes.numerical.Endianess |
_endianess |
|
protected int |
_lengthWidth |
|
protected REFERENCEE |
_referencee |
|
static String |
LENGTH_ENDIANESS |
|
static String |
LENGTH_WIDTH |
Constructor | Description |
---|---|
AbstractReferenceeLengthSegment() |
Constructs an empty allocation value with a width of
TransmissionMetrics.DEFAULT_LENGTH_WIDTH bytes used to specify
the decoratee's length and a
TransmissionMetrics.DEFAULT_ENDIANESS endian representation of
the decoratee's length. |
AbstractReferenceeLengthSegment(int aLengthWidth) |
Constructs an empty allocation value with the given number of bytes used
to specify the decoratee's length and a
TransmissionMetrics.DEFAULT_ENDIANESS endian representation of
the decoratee's length. |
AbstractReferenceeLengthSegment(int aLengthWidth,
org.refcodes.numerical.Endianess aEndianess) |
Constructs an empty allocation value with the given number of bytes used
to specify the decoratee's length and the provided
Endianess
representation of the decoratee's length. |
AbstractReferenceeLengthSegment(org.refcodes.numerical.Endianess aEndianess) |
Constructs an empty allocation value with a width of
TransmissionMetrics.DEFAULT_LENGTH_WIDTH bytes used to specify
the decoratee's length and the provided Endianess representation
of the decoratee's length. |
AbstractReferenceeLengthSegment(TransmissionMetrics aTransmissionMetrics) |
Constructs an according instance.
|
AbstractReferenceeLengthSegment(REFERENCEE aReferencee) |
Constructs the allocation value with the given decoratee and a width of
TransmissionMetrics.DEFAULT_LENGTH_WIDTH bytes used to specify
the decoratee's length a TransmissionMetrics.DEFAULT_ENDIANESS
endian representation of the decoratee's length. |
AbstractReferenceeLengthSegment(REFERENCEE aReferencee,
int aLengthWidth) |
Constructs the allocation value with the given decoratee and with the
given number of bytes used to specify the decoratee's length and a
TransmissionMetrics.DEFAULT_ENDIANESS endian representation of
the decoratee's length. |
AbstractReferenceeLengthSegment(REFERENCEE aReferencee,
int aLengthWidth,
org.refcodes.numerical.Endianess aEndianess) |
Constructs the allocation value with the given decoratee and with the
given number of bytes used to specify the decoratee's length and the
provided
Endianess representation of the decoratee's length. |
AbstractReferenceeLengthSegment(REFERENCEE aReferencee,
org.refcodes.numerical.Endianess aEndianess) |
Constructs the allocation value with the given decoratee and a width of
TransmissionMetrics.DEFAULT_LENGTH_WIDTH bytes used to specify
the decoratee's length and the provided Endianess representation
of the decoratee's length. |
AbstractReferenceeLengthSegment(REFERENCEE aReferencee,
TransmissionMetrics aTransmissionMetrics) |
Constructs an according instance.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
int |
fromTransmission(Sequence aSequence,
int aOffset) |
(Re-)initializes this instance with the the given
Sequence data. |
int |
getAllocLength() |
Returns the allocated length in bytes declared by this instance.
|
org.refcodes.numerical.Endianess |
getEndianess() |
|
int |
getLength() |
Determines the overall length of this
Transmission . |
int |
getLengthWidth() |
Retrieves the length width (in bytes) from the length width (in bytes)
property.
|
int |
hashCode() |
|
void |
receiveFrom(InputStream aInputStream,
OutputStream aReturnStream) |
(Re-)initializes this instance by receiving the according
Sequence from the given InputStream . |
Schema |
toSchema() |
Retrieves the
Schema representing the Transmission . |
org.refcodes.struct.SimpleTypeMap |
toSimpleTypeMap() |
Returns the
SimpleTypeMap representation of this
Transmission . |
String |
toString() |
|
Sequence |
toTransmission() |
Provides the
Sequence representation of this
Transmission . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFrom
fromInputStream, transmitTo, transmitTo
transmitTo
public static final String LENGTH_WIDTH
public static final String LENGTH_ENDIANESS
protected org.refcodes.numerical.Endianess _endianess
protected int _lengthWidth
protected int _allocLength
protected REFERENCEE extends Transmission _referencee
public AbstractReferenceeLengthSegment(TransmissionMetrics aTransmissionMetrics)
TransmissionMetrics
configuration object, though only
those attributes are supported which are also supported by the other
constructors!aTransmissionMetrics
- The TransmissionMetrics
to be used
for configuring this instance.public AbstractReferenceeLengthSegment(REFERENCEE aReferencee, TransmissionMetrics aTransmissionMetrics)
TransmissionMetrics
configuration object, though only
those attributes are supported which are also supported by the other
constructors!aReferencee
- The referenced Transmission
which's length is
to be used.aTransmissionMetrics
- The TransmissionMetrics
to be used
for configuring this instance.public AbstractReferenceeLengthSegment()
TransmissionMetrics.DEFAULT_LENGTH_WIDTH
bytes used to specify
the decoratee's length and a
TransmissionMetrics.DEFAULT_ENDIANESS
endian representation of
the decoratee's length.public AbstractReferenceeLengthSegment(org.refcodes.numerical.Endianess aEndianess)
TransmissionMetrics.DEFAULT_LENGTH_WIDTH
bytes used to specify
the decoratee's length and the provided Endianess
representation
of the decoratee's length.aEndianess
- The Endianess
to be used for length values.public AbstractReferenceeLengthSegment(int aLengthWidth)
TransmissionMetrics.DEFAULT_ENDIANESS
endian representation of
the decoratee's length.aLengthWidth
- The width (in bytes) to be used for length values.public AbstractReferenceeLengthSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Endianess
representation of the decoratee's length.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- The Endianess
to be used for length values.public AbstractReferenceeLengthSegment(REFERENCEE aReferencee)
TransmissionMetrics.DEFAULT_LENGTH_WIDTH
bytes used to specify
the decoratee's length a TransmissionMetrics.DEFAULT_ENDIANESS
endian representation of the decoratee's length.aReferencee
- The decoratee used for this allocation value.public AbstractReferenceeLengthSegment(REFERENCEE aReferencee, org.refcodes.numerical.Endianess aEndianess)
TransmissionMetrics.DEFAULT_LENGTH_WIDTH
bytes used to specify
the decoratee's length and the provided Endianess
representation
of the decoratee's length.aReferencee
- The decoratee used for this allocation value.aEndianess
- The Endianess
to be used for length values.public AbstractReferenceeLengthSegment(REFERENCEE aReferencee, int aLengthWidth)
TransmissionMetrics.DEFAULT_ENDIANESS
endian representation of
the decoratee's length.aReferencee
- The decoratee used for this allocation value.aLengthWidth
- The width (in bytes) to be used for length values.public AbstractReferenceeLengthSegment(REFERENCEE aReferencee, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Endianess
representation of the decoratee's length.aReferencee
- The decoratee used for this allocation value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- The Endianess
to be used for length values.public int getLengthWidth()
getLengthWidth
in interface LengthWidthAccessor
public Sequence toTransmission()
Sequence
representation of this
Transmission
. In case of nested Transmission
instances,
all Sequence
representations from all sub-segments are
accumulated to the result as well.toTransmission
in interface Transmission
Sequence
.public int fromTransmission(Sequence aSequence, int aOffset) throws TransmissionException
Sequence
data.fromTransmission
in interface Segment
aSequence
- The Sequence
data from which to (re-)initialize
this instance.aOffset
- The offset where to start processing the provided
Sequence
.Sequence
processed by this method.TransmissionException
- thrown in case a given Sequence
cannot be processed.public void receiveFrom(InputStream aInputStream, OutputStream aReturnStream) throws IOException, TransmissionException
Sequence
from the given InputStream
. Implementations
providing error correction methods use the provided feedback
OutputStream
to do some sort of "stop-and-wait ARQ" or apply
similar methods to ensure correctness of the received data.receiveFrom
in interface Segment
aInputStream
- The InputStream
from which to read the
instance's (re-)initialization Sequence
from.aReturnStream
- An OutputStream
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.IOException
- thrown in case reading data from the
InputStream
caused problems.TransmissionException
- thrown in case a given transmission cannot
be processed.public int getLength()
Transmission
. In case of
nested Transmission
instances, all length values from all
sub-segments are accumulated to the result as well.getLength
in interface org.refcodes.mixin.LengthAccessor
getLength
in interface Transmission
Transmission
(including any
sub-segments).public org.refcodes.numerical.Endianess getEndianess()
getEndianess
in interface org.refcodes.numerical.EndianessAccessor
public int getAllocLength()
getAllocLength
in interface AllocLengthAccessor
public Schema toSchema()
Schema
representing the Transmission
.
Retrieving a Schema
is useful when analyzing and debugging data
structures such as a AllocSectionDecoratorSegment
instance to help
document, learn and verify on the structure (as well as the content) of
that very AllocSectionDecoratorSegment
.toSchema
in interface Transmission
Schema
representation of the implementing type for
debugging and verification (or documentation) purposes.public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
SimpleTypeMap
representation of this
Transmission
. In case this Transmission has Transmission
children, then the children are queried as well and contained in the
resulting SimpleTypeMap
. The aliases of the according
Transmission
instances represent the resulting path to a
Transmission
's final simple type.toSimpleTypeMap
in interface Transmission
SimpleTypeMap
representing this Transmission
and (if any) its children, with the according aliases forming the
paths to the Transmission
's values.Copyright © 2021. All rights reserved.