Class StringSegment

java.lang.Object
org.refcodes.serial.StringSegment
All Implemented Interfaces:
Serializable, AliasAccessor, EncodingAccessor<Charset>, LengthAccessor, PayloadAccessor<String>, PayloadAccessor.PayloadBuilder<String, PayloadTransmission<String>>, PayloadAccessor.PayloadMutator<String>, PayloadAccessor.PayloadProperty<String>, Resetable, Diagnosable, Schemable<DiagnosticOptions>, PayloadSegment<String>, PayloadTransmission<String>, Segment, Transmission

public class StringSegment extends Object implements PayloadSegment<String>, EncodingAccessor<Charset>
The StringSegment is an implementation of a Section carrying a String as payload. By default, if not otherwise specified, the TransmissionMetrics.DEFAULT_ENCODING encoding is used for encoding and decoding String instances.
See Also:
  • Constructor Details

    • StringSegment

      public StringSegment()
      Instantiates a new string segment.
    • StringSegment

      public StringSegment(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.
    • StringSegment

      public StringSegment(String 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 StringSegment.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • StringSegment

      public StringSegment(String aAlias, String 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 StringSegment.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • StringSegment

      public StringSegment(String aValue)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
    • StringSegment

      public StringSegment(Charset aEncoding)
      Constructs a StringSegment with a payload expected to be encoded with the given Charset.
      Parameters:
      aEncoding - The Charset to be used for encoding and decoding String instances.
    • StringSegment

      public StringSegment(String aValue, Charset aEncoding)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
    • StringSegment

      public StringSegment(String aAlias, String aValue)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
    • StringSegment

      public StringSegment(String aAlias, String aValue, Charset aEncoding)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
    • StringSegment

      public StringSegment(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.
      Parameters:
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(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.
      Parameters:
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(int aLengthWidth, 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.
      Parameters:
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aValue, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(Charset aEncoding, Endianess aEndianess)
      Constructs a StringSegment with a payload expected to be encoded with the given Charset.
      Parameters:
      aEncoding - The Charset to be used for encoding and decoding String instances.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aValue, Charset aEncoding, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, Charset aEncoding, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aValue, int aLengthWidth)
      Constructs a StringSegment with the given Stringpayload* being encoded with the TransmissionMetrics.DEFAULT_ENCODING.**
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(Charset aEncoding, int aLengthWidth)
      Constructs a StringSegment with a payload expected to be encoded with the given Charset.
      Parameters:
      aEncoding - The Charset to be used for encoding and decoding String instances.
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(String aValue, Charset aEncoding, int aLengthWidth)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, int aLengthWidth)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, Charset aEncoding, int aLengthWidth)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aLengthWidth - The width (in bytes) to be used for length values.
    • StringSegment

      public StringSegment(String aValue, int aLengthWidth, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(Charset aEncoding, int aLengthWidth, Endianess aEndianess)
      Constructs a StringSegment with a payload expected to be encoded with the given Charset.
      Parameters:
      aEncoding - The Charset to be used for encoding and decoding String instances.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aValue, Charset aEncoding, int aLengthWidth, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, int aLengthWidth, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
    • StringSegment

      public StringSegment(String aAlias, String aValue, Charset aEncoding, int aLengthWidth, Endianess aEndianess)
      Constructs a StringSegment with the given String payload being encoded with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by this StringSegment.
      aEncoding - The Charset to be used for encoding the String.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for length values.
  • Method Details