Class AbstractMagicBytesTransmission

java.lang.Object
org.refcodes.serial.AbstractMagicBytesTransmission
All Implemented Interfaces:
Serializable, AliasAccessor, EncodingAccessor<Charset>, LengthAccessor, MagicBytesAccessor, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty, PayloadAccessor<byte[]>, PayloadAccessor.PayloadBuilder<byte[], PayloadTransmission<byte[]>>, PayloadAccessor.PayloadMutator<byte[]>, PayloadAccessor.PayloadProperty<byte[]>, Resetable, Diagnosable, Schemable<DiagnosticOptions>, MagicBytesAccessor, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty, MagicBytesLengthAccessor, PayloadTransmission<byte[]>, Transmission, Transmission.TransmissionMixin
Direct Known Subclasses:
AbstractMagicBytesTransmissionDecorator, MagicBytesSegment

Magic bytes are usually found (somewhere) at the beginning of a file or a stream. A AbstractMagicBytesTransmission provides the base functionality to manage magic bytes.
See Also:
  • Field Details

    • _magicBytes

      protected byte[] _magicBytes
    • _magicBytesLength

      protected int _magicBytesLength
    • _charset

      protected String _charset
    • _alias

      protected String _alias
  • Constructor Details

    • AbstractMagicBytesTransmission

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

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

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

      public AbstractMagicBytesTransmission(String aAlias, int aMagicBytesLength)
      Constructs an AbstractMagicBytesTransmission for 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.
    • AbstractMagicBytesTransmission

      public AbstractMagicBytesTransmission(String aAlias, String aMagicBytes)
      Constructs an AbstractMagicBytesTransmission 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).
    • AbstractMagicBytesTransmission

      public AbstractMagicBytesTransmission(String aAlias, String aMagicBytes, Charset aCharset)
      Constructs an AbstractMagicBytesTransmission 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.
    • AbstractMagicBytesTransmission

      public AbstractMagicBytesTransmission(String aAlias, byte[] aMagicBytes)
      Constructs an AbstractMagicBytesTransmission 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