Class MagicBytesSectionDecorator<DECORATEE extends Section>

Type Parameters:
DECORATEE - The Section type describing the Section 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>, DecoratorSection<DECORATEE>, MagicBytesAccessor, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty, MagicBytesLengthAccessor, PayloadTransmission<byte[]>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin
Direct Known Subclasses:
AssertMagicBytesSectionDecorator

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

    • MagicBytesSectionDecorator

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

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

      public MagicBytesSectionDecorator(DECORATEE aDecoratee, String aMagicBytes)
      Enriches the provided Section with magic bytes being prefixed (retrieved from the given String).
      Parameters:
      aDecoratee - The Section 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).
    • MagicBytesSectionDecorator

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

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

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

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

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

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