Class AsciizArraySegment

    • Constructor Detail

      • AsciizArraySegment

        public AsciizArraySegment​(TransmissionMetrics aTransmissionMetrics)
        Constructs an AsciizArraySegment from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
        Parameters:
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
      • AsciizArraySegment

        public AsciizArraySegment​(TransmissionMetrics aTransmissionMetrics,
                                  String... aValue)
        Constructs an AsciizArraySegment from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
        Parameters:
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
        aValue - The payload to be contained by the AsciizArraySegment.
      • AsciizArraySegment

        public AsciizArraySegment​(String aAlias,
                                  TransmissionMetrics aTransmissionMetrics)
        Constructs an AsciizArraySegment from the given configuration. The configuration attributes are taken from the TransmissionMetrics 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 instance.
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
      • AsciizArraySegment

        public AsciizArraySegment​(String aAlias,
                                  TransmissionMetrics aTransmissionMetrics,
                                  String... aValue)
        Constructs an AsciizArraySegment from the given configuration. The configuration attributes are taken from the TransmissionMetrics 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 instance.
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
        aValue - The payload to be contained by the AsciizArraySegment.
      • AsciizArraySegment

        public AsciizArraySegment​(int aLengthWidth,
                                  org.refcodes.numerical.Endianess aEndianess,
                                  String... aPayload)
        Constructs an AsciizArraySegment using the provided String elements and using the provided Segment class for creating Segment instances.
        Parameters:
        aLengthWidth - The width (in bytes) to be used for size values (number of elements in the payload array). * @param aEndianess The Endianess to be used for size values.
        aEndianess - the endianess
        aPayload - The String elements being contained in this instance.
      • AsciizArraySegment

        public AsciizArraySegment​(String aAlias,
                                  int aLengthWidth,
                                  org.refcodes.numerical.Endianess aEndianess,
                                  String... aPayload)
        Constructs an AsciizArraySegment using 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 - The Endianess to be used for size values.
        aPayload - The String elements being contained in this instance.
      • AsciizArraySegment

        public AsciizArraySegment​(String aAlias,
                                  TransmissionMetrics aTransmissionMetrics,
                                  byte aEndOfStringByte)
        Constructs an AsciizArraySegment from the given configuration. The configuration attributes are taken from the TransmissionMetrics 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 instance.
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
        aEndOfStringByte - The alternate value instead of 0 "zero" identifying the end of the string.
      • AsciizArraySegment

        public AsciizArraySegment​(byte aEndOfStringByte,
                                  int aLengthWidth,
                                  org.refcodes.numerical.Endianess aEndianess,
                                  String... aPayload)
        Constructs an AsciizArraySegment using the provided String elements and using the provided Segment class for creating Segment instances.
        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 The Endianess to be used for size values.
        aEndianess - the endianess
        aPayload - The String elements being contained in this instance.
      • AsciizArraySegment

        public AsciizArraySegment​(String aAlias,
                                  byte aEndOfStringByte,
                                  int aLengthWidth,
                                  org.refcodes.numerical.Endianess aEndianess,
                                  String... aPayload)
        Constructs an AsciizArraySegment using 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 - The Endianess to be used for size values.
        aPayload - The String elements being contained in this instance.
    • Method Detail

      • fromTransmission

        public int fromTransmission​(Sequence aSequence,
                                    int aOffset)
                             throws TransmissionException
        (Re-)initializes this instance with the the given Sequence data.
        Specified by:
        fromTransmission in interface Segment
        Parameters:
        aSequence - The Sequence data from which to (re-)initialize this instance.
        aOffset - The offset where to start processing the provided Sequence.
        Returns:
        The index after the last offset into the given Sequence processed by this method.
        Throws:
        TransmissionException - thrown in case a given Sequence cannot be processed.
      • transmitTo

        public void transmitTo​(OutputStream aOutputStream,
                               InputStream aReturnStream)
                        throws IOException
        Transmits the Sequence representing the implementing type's instance to the given OutputStream. Implementations providing error correction methods use the provided feedback InputStream to do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the transmitted data.
        Specified by:
        transmitTo in interface Transmission
        Specified by:
        transmitTo in interface Transmission.TransmissionMixin
        Parameters:
        aOutputStream - The OutputStream where to write this instance's Sequence to.
        aReturnStream - An InputStream 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 the OutputStream caused problems.
      • getLength

        public int getLength()
        Determines the overall length of this Transmission. In case of nested Transmission instances, all length values from all sub-segments are accumulated to the result as well.
        Specified by:
        getLength in interface org.refcodes.mixin.LengthAccessor
        Specified by:
        getLength in interface Transmission
        Returns:
        The (overall) length of the Transmission (including any sub-segments).
      • getLengthWidth

        public int getLengthWidth()
        Retrieves the length width (in bytes) from the length width (in bytes) property.
        Specified by:
        getLengthWidth in interface LengthWidthAccessor
        Returns:
        The length width (in bytes) stored by the length width (in bytes) property.
      • getEndianess

        public org.refcodes.numerical.Endianess getEndianess()
        Specified by:
        getEndianess in interface org.refcodes.numerical.EndianessAccessor
      • getEndOfStringByte

        public byte getEndOfStringByte()
        Retrieves the end of string byte from the end of string byte property.
        Specified by:
        getEndOfStringByte in interface EndOfStringByteAccessor
        Returns:
        The end of string byte stored by the end of string byte property.