- All Implemented Interfaces:
Serializable,org.refcodes.mixin.AliasAccessor,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.PayloadAccessor<String[]>,org.refcodes.mixin.PayloadAccessor.PayloadBuilder<String[],,PayloadTransmission<String[]>> org.refcodes.mixin.PayloadAccessor.PayloadMutator<String[]>,org.refcodes.mixin.PayloadAccessor.PayloadProperty<String[]>,org.refcodes.mixin.Resetable,org.refcodes.numerical.EndianessAccessor,org.refcodes.schema.Schemable,EndOfStringByteAccessor,LengthWidthAccessor,PayloadSegment<String[]>,PayloadTransmission<String[]>,Segment,Segment.SegmentMixin,Transmission,Transmission.TransmissionMixin
public class AsciizArraySegment
extends AbstractPayloadSegment<String[]>
implements LengthWidthAccessor, org.refcodes.numerical.EndianessAccessor, EndOfStringByteAccessor
The
AsciizArraySegment is an implementation of a Section
carrying a String array as payload. Each String is
represented by a String decorated by an
AllocSectionDecoratorSegment.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor
org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasPropertyNested 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.serial.EndOfStringByteAccessor
EndOfStringByteAccessor.EndOfStringByteBuilder<B extends EndOfStringByteAccessor.EndOfStringByteBuilder<B>>, EndOfStringByteAccessor.EndOfStringByteMutator, EndOfStringByteAccessor.EndOfStringBytePropertyNested 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.mixin.PayloadAccessor
org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P extends Object,B extends org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P, B>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<P extends Object>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<P extends Object> Nested 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.AbstractPayloadSegment
_alias, _payload -
Constructor Summary
ConstructorsConstructorDescriptionAsciizArraySegment(byte aEndOfStringByte, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the providedStringelements and using the providedSegmentclass for creatingSegmentinstances.AsciizArraySegment(byte aEndOfStringByte, String... aPayload) Constructs anAsciizArraySegmentcontaining the provided payload and using theTransmissionMetrics.DEFAULT_LENGTH_WIDTHas well as theTransmissionMetrics.DEFAULT_ENDIANESS.AsciizArraySegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the providedStringelements and using the providedSegmentclass for creatingSegmentinstances.AsciizArraySegment(String... aPayload) Constructs anAsciizArraySegmentcontaining the provided payload and using theTransmissionMetrics.DEFAULT_LENGTH_WIDTHas well as theTransmissionMetrics.DEFAULT_ENDIANESS.AsciizArraySegment(String aAlias, byte aEndOfStringByte, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the provided arguments.AsciizArraySegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the provided arguments.AsciizArraySegment(String aAlias, TransmissionMetrics aTransmissionMetrics) Constructs anAsciizArraySegmentfrom the given configuration.AsciizArraySegment(String aAlias, TransmissionMetrics aTransmissionMetrics, byte aEndOfStringByte) Constructs anAsciizArraySegmentfrom the given configuration.AsciizArraySegment(String aAlias, TransmissionMetrics aTransmissionMetrics, String... aValue) Constructs anAsciizArraySegmentfrom the given configuration.AsciizArraySegment(TransmissionMetrics aTransmissionMetrics) Constructs anAsciizArraySegmentfrom the given configuration.AsciizArraySegment(TransmissionMetrics aTransmissionMetrics, String... aValue) Constructs anAsciizArraySegmentfrom the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionintfromTransmission(Sequence aSequence, int aOffset) (Re-)initializes this instance with the the givenSequencedata.getAlias()org.refcodes.numerical.EndianessbyteRetrieves the end of string byte from the end of string byte property.intDetermines the overall length of thisTransmission.intRetrieves the length width (in bytes) from the length width (in bytes) property.voidreceiveFrom(InputStream aInputStream, OutputStream aReturnStream) (Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream.voidreset()Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!)toSchema()Provides theSequencerepresentation of thisTransmission.org.refcodes.struct.SimpleTypeMapReturns theSimpleTypeMaprepresentation of thisTransmission.voidtransmitTo(OutputStream aOutputStream, InputStream aReturnStream) Transmits theSequencerepresenting the implementing type's instance to the givenOutputStream.withPayload(String[] aValue) Methods inherited from class org.refcodes.serial.AbstractPayloadSegment
equals, getPayload, hashCode, setPayload, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.mixin.PayloadAccessor
getPayloadOrMethods inherited from interface org.refcodes.mixin.PayloadAccessor.PayloadProperty
letPayloadMethods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
transmitTo, transmitTo
-
Constructor Details
-
AsciizArraySegment
Constructs anAsciizArraySegmentfrom the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AsciizArraySegment
Constructs anAsciizArraySegmentfrom the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.aValue- The payload to be contained by theAsciizArraySegment.
-
AsciizArraySegment
Constructs anAsciizArraySegmentfrom the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration 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 instance.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AsciizArraySegment
public AsciizArraySegment(String aAlias, TransmissionMetrics aTransmissionMetrics, String... aValue) Constructs anAsciizArraySegmentfrom the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration 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 instance.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.aValue- The payload to be contained by theAsciizArraySegment.
-
AsciizArraySegment
Constructs anAsciizArraySegmentcontaining the provided payload and using theTransmissionMetrics.DEFAULT_LENGTH_WIDTHas well as theTransmissionMetrics.DEFAULT_ENDIANESS.- Parameters:
aPayload- TheStringelements being contained in this instance.
-
AsciizArraySegment
public AsciizArraySegment(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the providedStringelements and using the providedSegmentclass for creatingSegmentinstances.- Parameters:
aLengthWidth- The width (in bytes) to be used for size values (number of elements in the payload array). * @param aEndianess TheEndianessto be used for size values.aEndianess- the endianessaPayload- TheStringelements being contained in this instance.
-
AsciizArraySegment
public AsciizArraySegment(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the provided arguments.- Parameters:
aAlias- The alias which identifies the content of this segment.aLengthWidth- The width (in bytes) to be used for size values (number of elements in the payload array).aEndianess- TheEndianessto be used for size values.aPayload- TheStringelements being contained in this instance.
-
AsciizArraySegment
public AsciizArraySegment(String aAlias, TransmissionMetrics aTransmissionMetrics, byte aEndOfStringByte) Constructs anAsciizArraySegmentfrom the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration 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 instance.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.aEndOfStringByte- The alternate value instead of 0 "zero" identifying the end of the string.
-
AsciizArraySegment
Constructs anAsciizArraySegmentcontaining the provided payload and using theTransmissionMetrics.DEFAULT_LENGTH_WIDTHas well as theTransmissionMetrics.DEFAULT_ENDIANESS.- Parameters:
aEndOfStringByte- The alternate value instead of 0 "zero" identifying the end of the string.aPayload- TheStringelements being contained in this instance.
-
AsciizArraySegment
public AsciizArraySegment(byte aEndOfStringByte, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the providedStringelements and using the providedSegmentclass for creatingSegmentinstances.- Parameters:
aEndOfStringByte- The alternate value instead of 0 "zero" identifying the end of the string.aLengthWidth- The width (in bytes) to be used for size values (number of elements in the payload array). * @param aEndianess TheEndianessto be used for size values.aEndianess- the endianessaPayload- TheStringelements being contained in this instance.
-
AsciizArraySegment
public AsciizArraySegment(String aAlias, byte aEndOfStringByte, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aPayload) Constructs anAsciizArraySegmentusing the provided arguments.- Parameters:
aAlias- The alias which identifies the content of this segment.aEndOfStringByte- The alternate value instead of 0 "zero" identifying the end of the string.aLengthWidth- The width (in bytes) to be used for size values (number of elements in the payload array).aEndianess- TheEndianessto be used for size values.aPayload- TheStringelements being contained in this instance.
-
-
Method Details
-
fromTransmission
(Re-)initializes this instance with the the givenSequencedata.- Specified by:
fromTransmissionin interfaceSegment- Parameters:
aSequence- TheSequencedata 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
Sequenceprocessed by this method. - Throws:
TransmissionException- thrown in case a givenSequencecannot be processed.
-
receiveFrom
(Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream. Implementations providing error correction methods use the provided feedbackOutputStreamto do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the received data.- Specified by:
receiveFromin interfaceSegment- Specified by:
receiveFromin interfaceSegment.SegmentMixin- Parameters:
aInputStream- TheInputStreamfrom which to read the instance's (re-)initializationSequencefrom.aReturnStream- AnOutputStreambeing 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 theInputStreamcaused problems.TransmissionException- thrown in case a given transmission cannot be processed.
-
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- 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.
-
reset
public void reset()Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!) reset any configurations or settings required to produce the dynamic data (e.g. theTransmissionMetrics).- Specified by:
resetin interfaceorg.refcodes.mixin.Resetable- Specified by:
resetin interfaceTransmission- Overrides:
resetin classAbstractPayloadSegment<String[]>
-
toSchema
- Specified by:
toSchemain interfaceorg.refcodes.schema.Schemable- Specified by:
toSchemain interfaceTransmission
-
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- Returns:
- The (overall) length of the
Transmission(including any sub-segments).
-
withPayload
- Specified by:
withPayloadin interfaceorg.refcodes.mixin.PayloadAccessor.PayloadBuilder<String[],PayloadTransmission<String[]>>
-
getLengthWidth
public int getLengthWidth()Retrieves the length width (in bytes) from the length width (in bytes) property.- Specified by:
getLengthWidthin interfaceLengthWidthAccessor- Returns:
- The length width (in bytes) stored by the length width (in bytes) property.
-
getEndianess
public org.refcodes.numerical.Endianess getEndianess()- Specified by:
getEndianessin interfaceorg.refcodes.numerical.EndianessAccessor
-
getAlias
- Specified by:
getAliasin interfaceorg.refcodes.mixin.AliasAccessor- Overrides:
getAliasin classAbstractPayloadSegment<String[]>
-
toSimpleTypeMap
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()Returns theSimpleTypeMaprepresentation of thisTransmission. In case this Transmission hasTransmissionchildren, then the children are queried as well and contained in the resultingSimpleTypeMap. The aliases of the accordingTransmissioninstances represent the resulting path to aTransmission's final simple type.- Specified by:
toSimpleTypeMapin interfaceTransmission- Overrides:
toSimpleTypeMapin classAbstractPayloadSegment<String[]>- Returns:
- The
SimpleTypeMaprepresenting thisTransmissionand (if any) its children, with the according aliases forming the paths to theTransmission's values.
-
getEndOfStringByte
public byte getEndOfStringByte()Retrieves the end of string byte from the end of string byte property.- Specified by:
getEndOfStringBytein interfaceEndOfStringByteAccessor- Returns:
- The end of string byte stored by the end of string byte property.
-