Class ByteArraySection

java.lang.Object
org.refcodes.serial.AbstractPayloadSection<byte[]>
org.refcodes.serial.ByteArraySection
All Implemented Interfaces:
Serializable, AliasAccessor, LengthAccessor, PayloadAccessor<byte[]>, PayloadAccessor.PayloadBuilder<byte[], PayloadTransmission<byte[]>>, PayloadAccessor.PayloadMutator<byte[]>, PayloadAccessor.PayloadProperty<byte[]>, Resetable, Diagnosable, Schemable<DiagnosticOptions>, PayloadSection<byte[]>, PayloadTransmission<byte[]>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin

public class ByteArraySection extends AbstractPayloadSection<byte[]>
The ByteArraySection is an implementation of a Section carrying a byte array as payload.
See Also:
  • Constructor Details

  • 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.
      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.
      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.
      Returns:
      The (overall) length of the Transmission (including any sub-segments).
    • toSchema

      public Schema toSchema()
    • toString

      public String toString()
      Overrides:
      toString in class AbstractPayloadSection<byte[]>
    • withPayload

      public ByteArraySection withPayload(byte[] aValue)
    • setPayload

      public void setPayload(Byte[] aPayload)
      Convenience method to convert the array of wrapper types into its counterpart with primitive types before invoking AbstractPayloadSection.setPayload(Object).
      Parameters:
      aPayload - The payload with the wrapper types.
    • withPayload

      public ByteArraySection withPayload(Byte[] aPayload)
      Convenience method to convert the array of wrapper types into its counterpart with primitive types before invoking withPayload(byte[]).
      Parameters:
      aPayload - The payload with the wrapper types.
      Returns:
      This instance as of the builder pattern.