Class MagicBytesSegmentDecorator<DECORATEE extends Segment>

Type Parameters:
DECORATEE - The Segment type describing the Segment subclass decoratee.
All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.DecorateeAccessor<DECORATEE>, 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<SerialSchema>, DecoratorSegment<DECORATEE>, MagicBytesAccessor, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty, MagicBytesLengthAccessor, PayloadTransmission<byte[]>, Segment, Segment.SegmentMixin, Transmission, Transmission.TransmissionMixin
Direct Known Subclasses:
AssertMagicBytesSegmentDecorator

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

    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(DECORATEE aDecoratee, TransmissionMetrics aTransmissionMetrics)
      Enriches the provided decoratee with magic bytes of the given length to be prefixed. 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:
      aDecoratee - The decoratee which to be prefixed with magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(String aAlias, DECORATEE aDecoratee, TransmissionMetrics aTransmissionMetrics)
      Enriches the provided decoratee with magic bytes of the given length to be prefixed. 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.
      aDecoratee - The decoratee which to be prefixed with magic bytes.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(DECORATEE aDecoratee, int aMagicBytesLength)
      Enriches the provided Segment with magic bytes of the given length to be prefixed.
      Parameters:
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytesLength - The length of the magic bytes sequence.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(DECORATEE aDecoratee, String aMagicBytes)
      Enriches the provided Segment with magic bytes being prefixed (retrieved from the given String).
      Parameters:
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytes - The String to be stored by this instance as magic bytes (uses the TransmissionMetrics.DEFAULT_ENCODING) for byte conversion).
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(DECORATEE aDecoratee, String aMagicBytes, Charset aCharset)
      Enriches the provided Segment with magic bytes being prefixed (retrieved from the given String).
      Parameters:
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      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.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(DECORATEE aDecoratee, byte... aMagicBytes)
      Enriches the provided Segment with the given magic bytes being prefixed.
      Parameters:
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytes - The magic bytes to be prefixed.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(String aAlias, DECORATEE aDecoratee, int aMagicBytesLength)
      Enriches the provided Segment with magic bytes of the given length to be prefixed.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytesLength - The length of the magic bytes sequence.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(String aAlias, DECORATEE aDecoratee, String aMagicBytes)
      Enriches the provided Segment with magic bytes being prefixed (retrieved from the given String).
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytes - The String to be stored by this instance as magic bytes (uses the TransmissionMetrics.DEFAULT_ENCODING) for byte conversion).
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(String aAlias, DECORATEE aDecoratee, String aMagicBytes, Charset aCharset)
      Enriches the provided Segment with magic bytes being prefixed (retrieved from the given String).
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      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.
    • MagicBytesSegmentDecorator

      public MagicBytesSegmentDecorator(String aAlias, DECORATEE aDecoratee, byte... aMagicBytes)
      Enriches the provided Segment with the given magic bytes being prefixed.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aDecoratee - The Segment which is to be prefixed with magic bytes.
      aMagicBytes - The magic bytes to be prefixed.
  • Method Details