Class MagicBytesSegment

All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.MagicBytesAccessor, org.refcodes.mixin.MagicBytesAccessor.MagicBytesMutator, org.refcodes.mixin.MagicBytesAccessor.MagicBytesProperty, org.refcodes.mixin.PayloadAccessor<byte[]>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<byte[],PayloadTransmission<byte[]>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<byte[]>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<byte[]>, org.refcodes.mixin.Schemable, MagicBytesAccessor, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty, MagicBytesLengthAccessor, PayloadTransmission<byte[]>, Segment, Segment.SegmentMixin, Transmission, Transmission.TransmissionMixin
Direct Known Subclasses:
AssertMagicBytesSegment

public class MagicBytesSegment extends AbstractMagicBytesTransmission implements Segment.SegmentMixin, Segment
Magic bytes are usually found (somewhere) at the beginning of a file or a stream. A MagicBytesSegment decorates a Segment decoratee and prefixes this Segment instance with given magic bytes.
See Also:
  • Constructor Details

    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, String aMagicBytes, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance for magic bytes of the given length. 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 segment.
      aMagicBytes - The String to be stored by this instance as magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, byte[] aMagicBytes, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance for magic bytes of the given length. 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 segment.
      aMagicBytes - The bytes to be stored by this instance as magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegment

      public MagicBytesSegment(TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance for magic bytes of the given length. 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.
    • MagicBytesSegment

      public MagicBytesSegment(String aMagicBytes, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance for magic bytes of the given length. 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:
      aMagicBytes - The String to be stored by this instance as magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegment

      public MagicBytesSegment(byte[] aMagicBytes, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance for magic bytes of the given length. 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:
      aMagicBytes - The bytes to be stored by this instance as magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegment

      public MagicBytesSegment(int aMagicBytesLength)
      Constructs an according instance with magic bytes of the given length.
      Parameters:
      aMagicBytesLength - The length of the magic bytes sequence..
    • MagicBytesSegment

      public MagicBytesSegment(String aMagicBytes)
      Constructs an according instance with the according magic bytes (retrieved from the given String).
      Parameters:
      aMagicBytes - The String to be stored by this instance as magic bytes (uses the TransmissionMetrics.DEFAULT_ENCODING) for byte conversion).
    • MagicBytesSegment

      public MagicBytesSegment(String aMagicBytes, Charset aCharset)
      Constructs an according instance with the according magic bytes (retrieved from the given String).
      Parameters:
      aMagicBytes - The String to be stored by this instance as magic bytes.
      aCharset - The Charset to use when converting the String to a byte array.
    • MagicBytesSegment

      public MagicBytesSegment(byte... aMagicBytes)
      Constructs an according instance with the according magic bytes.
      Parameters:
      aMagicBytes - The magic bytes to be stored by this instance.
    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, int aMagicBytesLength)
      Constructs an according instance with magic bytes of the given length.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aMagicBytesLength - The length of the magic bytes sequence..
    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, String aMagicBytes)
      Constructs an according instance with the according magic bytes (retrieved from the given String).
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aMagicBytes - The String to be stored by this instance as magic bytes (uses the TransmissionMetrics.DEFAULT_ENCODING) for byte conversion).
    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, String aMagicBytes, Charset aCharset)
      Constructs an according instance with the according magic bytes (retrieved from the given String).
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aMagicBytes - The String to be stored by this instance as magic bytes.
      aCharset - The Charset to use when converting the String to a byte array.
    • MagicBytesSegment

      public MagicBytesSegment(String aAlias, byte... aMagicBytes)
      Constructs an according instance with the according magic bytes.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aMagicBytes - The magic bytes to be stored by this instance.
  • Method Details