- java.lang.Object
-
- org.refcodes.serial.DynamicTypeSegment
-
- All Implemented Interfaces:
Serializable
,org.refcodes.mixin.EncodingAccessor<Charset>
,org.refcodes.mixin.LengthAccessor
,org.refcodes.numerical.EndianessAccessor
,DynamicTypeTransmission
,LengthWidthAccessor
,Segment
,Transmission
public class DynamicTypeSegment extends Object implements Segment, LengthWidthAccessor, org.refcodes.numerical.EndianessAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, DynamicTypeTransmission
TheDynamicTypeSegment
represents aSegment
which's internal raw data is created from provided types at runtime and which's internal raw data is used to create provided types at runtime. It is implemented by decorating aDynamicTypeSection
with anAllocSectionDecoratorSegment
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.EncodingAccessor
org.refcodes.mixin.EncodingAccessor.EncodingBuilder<E extends Object,B extends org.refcodes.mixin.EncodingAccessor.EncodingBuilder<E,B>>, org.refcodes.mixin.EncodingAccessor.EncodingMutator<E extends Object>, org.refcodes.mixin.EncodingAccessor.EncodingProperty<E 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
-
-
Constructor Summary
Constructors Constructor Description DynamicTypeSegment()
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(String aAlias, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias, T aValue)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias, T aValue, String... aAttributes)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(String aAlias, T aValue, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(String aAlias, T aValue, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(T aValue)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(T aValue, String... aAttributes)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).DynamicTypeSegment(T aValue, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(T aValue, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.DynamicTypeSegment(T aValue, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties.DynamicTypeSegment(T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
fromTransmission(Sequence aSequence, int aOffset)
(Re-)initializes this instance with the the givenSequence
data.<T> void
fromType(T aValue)
Constructs theDynamicTypeSection
'sSequence
from the given type's instance .<T> void
fromType(T aValue, String... aAttributes)
Constructs an instance for the given type T. .Charset
getEncoding()
org.refcodes.numerical.Endianess
getEndianess()
int
getLength()
Determines the overall length of thisTransmission
.int
getLengthWidth()
Retrieves the length width (in bytes) from the length width (in bytes) property.void
receiveFrom(InputStream aInputStream, OutputStream aReturnStream)
(Re-)initializes this instance by receiving the accordingSequence
from the givenInputStream
.Schema
toSchema()
Retrieves theSchema
representing theTransmission
.Sequence
toSequence()
Provides theSequence
representation of thisTransmission
.org.refcodes.struct.SimpleTypeMap
toSimpleTypeMap()
Returns theSimpleTypeMap
representation of thisTransmission
.<T> T
toType(Class<T> aType)
Constructs an instance for the given type T.<T> T
toType(Class<T> aType, String... aAttributes)
Constructs an instance for the given type T. .void
transmitTo(OutputStream aOutputStream, InputStream aReturnStream)
Transmits theSequence
representing the implementing type's instance to the givenOutputStream
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFrom
-
Methods inherited from interface org.refcodes.serial.Transmission
transmitTo, transmitTo
-
-
-
-
Constructor Detail
-
DynamicTypeSegment
public DynamicTypeSegment()
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).
-
DynamicTypeSegment
public DynamicTypeSegment(Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.
-
DynamicTypeSegment
public DynamicTypeSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.- Parameters:
aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.
-
DynamicTypeSegment
public DynamicTypeSegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
).- Parameters:
aAlias
- The alias which identifies the content of this segment.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
.- Parameters:
aAlias
- The alias which identifies the content of this segment.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
). It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
. It is pre-initialized with the given value as offromType(Object)
.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
. It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aCharset
- TheCharset
to be used for encoding and decodingString
instances.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
. It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aCharset
- TheCharset
to be used for encoding and decodingString
instances.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aCharset
- TheCharset
to be used for encoding and decodingString
instances.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
. It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, String... aAttributes)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
). It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object)
. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object, String...)
. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aAlias
- The alias which identifies the content of this segment.aValue
- The data structure's value.aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(String aAlias, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aAlias
- The alias which identifies the content of this segment.aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
). It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, Charset aCharset)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
. It is pre-initialized with the given value as offromType(Object)
.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the givenCharSection
, as well as with theTransmissionMetrics.DEFAULT_LENGTH_WIDTH
and theTransmissionMetrics.DEFAULT_ENDIANESS
. It is pre-initialized with the given value as offromType(Object, String...)
.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
. It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aCharset
- TheCharset
to be used for encoding and decodingString
instances.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aCharset
- TheCharset
to be used for encoding and decodingString
instances.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties as well as with theTransmissionMetrics.DEFAULT_ENCODING
. It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aLengthWidth
- The width (in bytes) to be used for length values.aEndianess
- TheEndianess
to be used for (length) values.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, String... aAttributes)
Constructs theDynamicTypeSegment
with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH
,TransmissionMetrics.DEFAULT_ENDIANESS
as well asTransmissionMetrics.DEFAULT_ENCODING
). It is pre-initialized with the given value as offromType(Object, String...)
.- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object)
. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.
-
DynamicTypeSegment
public DynamicTypeSegment(T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
Constructs theDynamicTypeSegment
with the given properties. It is pre-initialized with the given value as offromType(Object, String...)
. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
DynamicTypeSegment
public DynamicTypeSegment(TransmissionMetrics aTransmissionMetrics)
Constructs theDynamicTypeSegment
with the given properties. The configuration attributes are taken from theTransmissionMetrics
configuration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aTransmissionMetrics
- TheTransmissionMetrics
to be used for configuring this instance.
-
-
Method Detail
-
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
- Returns:
- The (overall) length of the
Transmission
(including any sub-segments).
-
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
- 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
- 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.
-
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
- Returns:
- The
Schema
representation of the implementing type for debugging and verification (or documentation) purposes.
-
toSimpleTypeMap
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
Returns theSimpleTypeMap
representation of thisTransmission
. In case this Transmission hasTransmission
children, then the children are queried as well and contained in the resultingSimpleTypeMap
. The aliases of the accordingTransmission
instances represent the resulting path to aTransmission
's final simple type.- Specified by:
toSimpleTypeMap
in interfaceTransmission
- Returns:
- The
SimpleTypeMap
representing thisTransmission
and (if any) its children, with the according aliases forming the paths to theTransmission
's values.
-
toType
public <T> T toType(Class<T> aType) throws IllegalArgumentException
Constructs an instance for the given type T. The attributes of the given data structure are processed all and in alphabetical order. For specifying a predefined set of attributes and their order, please invokeDynamicTypeTransmission.fromType(Object, String...)
instead!- Specified by:
toType
in interfaceDynamicTypeTransmission
- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aType
- The data structure's type.- Returns:
- The according type constructed from the
DynamicTypeSection
'sSequence
. - Throws:
IllegalArgumentException
- thrown in case theDynamicTypeSection
'sSequence
does not match the provided type.
-
toType
public <T> T toType(Class<T> aType, String... aAttributes) throws IllegalArgumentException
Constructs an instance for the given type T. . The attributes of the given data structure are processed using the predefined set of attributes in their according order- Specified by:
toType
in interfaceDynamicTypeTransmission
- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aType
- The data structure's type.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.- Returns:
- The according type constructed from the
DynamicTypeSection
'sSequence
. - Throws:
IllegalArgumentException
- thrown in case theDynamicTypeSection
'sSequence
does not match the provided type.
-
fromType
public <T> void fromType(T aValue)
Constructs theDynamicTypeSection
'sSequence
from the given type's instance . The attributes of the given data structure are processed all and in alphabetical order. For specifying a predefined set of attributes and their order, please invokeDynamicTypeTransmission.fromType(Object, String[])
instead!- Specified by:
fromType
in interfaceDynamicTypeTransmission
- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.
-
fromType
public <T> void fromType(T aValue, String... aAttributes)
Constructs an instance for the given type T. . The attributes of the given data structure are processed using the predefined set of attributes in their according order.- Specified by:
fromType
in interfaceDynamicTypeTransmission
- Type Parameters:
T
- The type of the data structure representing the body.- Parameters:
aValue
- The data structure's value.aAttributes
- The attributes or null if all attributes are to be processed in alphabetical order.
-
getEncoding
public Charset getEncoding()
- Specified by:
getEncoding
in interfaceorg.refcodes.mixin.EncodingAccessor<Charset>
-
getEndianess
public org.refcodes.numerical.Endianess getEndianess()
- Specified by:
getEndianess
in interfaceorg.refcodes.numerical.EndianessAccessor
-
getLengthWidth
public int getLengthWidth()
Retrieves the length width (in bytes) from the length width (in bytes) property.- Specified by:
getLengthWidth
in interfaceLengthWidthAccessor
- Returns:
- The length width (in bytes) stored by the length width (in bytes) property.
-
fromTransmission
public int fromTransmission(Sequence aSequence, int aOffset) throws TransmissionException
(Re-)initializes this instance with the the givenSequence
data.- Specified by:
fromTransmission
in interfaceSegment
- Parameters:
aSequence
- TheSequence
data from which to (re-)initialize this instance.aOffset
- The offset where to start processing the providedSequence
.- Returns:
- The index after the last offset into the given
Sequence
processed by this method. - Throws:
TransmissionException
- thrown in case a givenSequence
cannot be processed.
-
receiveFrom
public void receiveFrom(InputStream aInputStream, OutputStream aReturnStream) throws IOException, TransmissionException
(Re-)initializes this instance by receiving the accordingSequence
from the givenInputStream
. Implementations providing error correction methods use the provided feedbackOutputStream
to do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the received data.- Specified by:
receiveFrom
in interfaceSegment
- Parameters:
aInputStream
- TheInputStream
from which to read the instance's (re-)initializationSequence
from.aReturnStream
- AnOutputStream
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 reading data from theInputStream
caused problems.TransmissionException
- thrown in case a given transmission cannot be processed.
-
-