Class CharSection

All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<Character>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<Character,PayloadTransmission<Character>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<Character>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<Character>, org.refcodes.mixin.Resetable, org.refcodes.schema.Schemable, PayloadSection<Character>, PayloadTransmission<Character>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin

public class CharSection extends AbstractPayloadSection<Character> implements Section, org.refcodes.mixin.EncodingAccessor<Charset>
The CharSection is an implementation of a Section carrying a char value as payload.
See Also:
  • Constructor Details

    • CharSection

      public CharSection(TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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.
    • CharSection

      public CharSection(char aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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:
      aValue - The payload to be contained by the CharSection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • CharSection

      public CharSection(Character aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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:
      aValue - The payload to be contained by the CharSection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • CharSection

      public CharSection(String aAlias, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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.
    • CharSection

      public CharSection(String aAlias, char aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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.
      aValue - The payload to be contained by the CharSection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • CharSection

      public CharSection(String aAlias, Character aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance 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.
      aValue - The payload to be contained by the CharSection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • CharSection

      public CharSection()
      Constructs an empty CharSection.
    • CharSection

      public CharSection(Charset aCharset)
      Constructs an empty CharSection with the given Charset.
      Parameters:
      aCharset - The charset to be used for encoding.
    • CharSection

      public CharSection(Character aPayload)
      Constructs a CharSection with the given char payload.
      Parameters:
      aPayload - The payload to be contained by the Section.
    • CharSection

      public CharSection(Character aPayload, Charset aCharset)
      Constructs a CharSection with the given char payload and the given Charset.
      Parameters:
      aPayload - The payload to be contained by the Section.
      aCharset - The charset to be used for encoding.
    • CharSection

      public CharSection(String aAlias)
      Constructs an empty CharSection.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
    • CharSection

      public CharSection(String aAlias, Charset aCharset)
      Constructs an empty CharSection with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aCharset - The charset to be used for encoding.
    • CharSection

      public CharSection(String aAlias, Character aPayload)
      Constructs a CharSection with the given char payload.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aPayload - The payload to be contained by the Section.
    • CharSection

      public CharSection(String aAlias, Character aPayload, Charset aCharset)
      Constructs a CharSection with the given char payload and the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aPayload - The payload to be contained by the Section.
      aCharset - The charset to be used for encoding.
  • Method Details

    • toSequence

      public Sequence toSequence()
      Provides the 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. Caution, the Transmission (or its nested Transmission instances) may be backed by the returned Sequence.
      Specified by:
      toSequence in interface Transmission
      Returns:
      The according instance's Sequence.
    • fromTransmission

      public void fromTransmission(Sequence aSequence, int aOffset, int aLength) throws TransmissionException
      (Re-)initializes this instance with the the given Sequence data.
      Specified by:
      fromTransmission in interface Section
      Parameters:
      aSequence - The Sequence data from which to (re-)initialize this instance.
      aOffset - The offset where to start processing the provided Sequence.
      aLength - The length of data assigned by the Sequence.
      Throws:
      TransmissionException - thrown in case a given Sequence cannot be processed.
    • 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).
    • toSchema

      public SerialSchema toSchema()
      Specified by:
      toSchema in interface org.refcodes.schema.Schemable
      Specified by:
      toSchema in interface Transmission
    • withPayload

      public CharSection withPayload(Character aValue)
      Specified by:
      withPayload in interface org.refcodes.mixin.PayloadAccessor.PayloadBuilder<Character,PayloadTransmission<Character>>
    • getEncoding

      public Charset getEncoding()
      Specified by:
      getEncoding in interface org.refcodes.mixin.EncodingAccessor<Charset>