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<T,PayloadTransmission<T>>
, org.refcodes.mixin.PayloadAccessor.PayloadMutator<byte[]>
, org.refcodes.mixin.PayloadAccessor.PayloadProperty<byte[]>
, MagicBytesAccessor
, MagicBytesAccessor.MagicBytesMutator
, MagicBytesAccessor.MagicBytesProperty
, MagicBytesLengthAccessor
, PayloadTransmission<byte[]>
, Transmission
, Transmission.TransmissionMixin
AbstractMagicBytesTransmissionDecorator
, MagicBytesSegment
public abstract class AbstractMagicBytesTransmission extends Object implements PayloadTransmission<byte[]>, Transmission.TransmissionMixin, MagicBytesAccessor.MagicBytesProperty, MagicBytesLengthAccessor, org.refcodes.mixin.EncodingAccessor<Charset>
AbstractMagicBytesTransmission
provides the base
functionality to manage magic bytes.org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasProperty
org.refcodes.mixin.EncodingAccessor.EncodingBuilder<E extends Object,B extends org.refcodes.mixin.EncodingAccessor.EncodingBuilder<E,B>>, org.refcodes.mixin.EncodingAccessor.EncodingMutator<E extends Object>, org.refcodes.mixin.EncodingAccessor.EncodingProperty<E extends Object>
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthProperty
MagicBytesAccessor.MagicBytesBuilder<B extends MagicBytesAccessor.MagicBytesBuilder<B>>, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty
MagicBytesLengthAccessor.MagicBytesLengthBuilder<B extends MagicBytesLengthAccessor.MagicBytesLengthBuilder<B>>, MagicBytesLengthAccessor.MagicBytesLengthMutator, MagicBytesLengthAccessor.MagicBytesLengthProperty
org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P extends Object,B extends org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P,B>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<P extends Object>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<P extends Object>
Transmission.TransmissionMixin
Modifier and Type | Field | Description |
---|---|---|
protected String |
_alias |
|
protected String |
_charset |
|
protected byte[] |
_magicBytes |
|
protected int |
_magicBytesLength |
|
static String |
MAGIC_BYTES |
|
static String |
MAGIC_BYTES_TEXT |
Constructor | Description |
---|---|
AbstractMagicBytesTransmission(String aAlias,
byte[] aMagicBytes) |
Constructs an
AbstractMagicBytesTransmission with the according
magic bytes. |
AbstractMagicBytesTransmission(String aAlias,
int aMagicBytesLength) |
Constructs an
AbstractMagicBytesTransmission for magic bytes of
the given length. |
AbstractMagicBytesTransmission(String aAlias,
String aMagicBytes) |
Constructs an
AbstractMagicBytesTransmission with the according
magic bytes (retrieved from the given String ). |
AbstractMagicBytesTransmission(String aAlias,
String aMagicBytes,
Charset aCharset) |
Constructs an
AbstractMagicBytesTransmission with the according
magic bytes (retrieved from the given String ). |
AbstractMagicBytesTransmission(String aAlias,
TransmissionMetrics aTransmissionMetrics) |
Constructs an according instance for magic bytes of the given length.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
String |
getAlias() |
|
Charset |
getEncoding() |
|
byte[] |
getMagicBytes() |
Returns the magic bytes as stored by this instance.
|
int |
getMagicBytesLength() |
Retrieves the magic bytes length from the magic bytes magic bytes length
property.
|
byte[] |
getPayload() |
Returns the magic bytes as of
getMagicBytes() . |
int |
hashCode() |
|
void |
setMagicBytes(byte[] aMagicBytes) |
Sets the magic bytes to be stored by this instance.
|
void |
setMagicBytes(String aMagicBytes) |
Sets the magic bytes from the provided
String to be stored by
this instance (uses the TransmissionMetrics.DEFAULT_ENCODING ) for
byte conversion). |
void |
setMagicBytes(String aMagicBytes,
Charset aCharset) |
Sets the magic bytes from the provided
String to be stored by
this instance. |
void |
setPayload(byte[] aValue) |
Sets the magic bytes as of
setMagicBytes(byte[]) . |
String |
toMagicBytesString() |
Retrieves the
String representation of the given magic bytes
using the latest provided Charset for conversion or the
TransmissionMetrics.DEFAULT_ENCODING in case no Charset
has been provided. |
String |
toMagicBytesString(String aCharset) |
Retrieves the
String representation of the given magic bytes
using the provided Charset for conversion or the
TransmissionMetrics.DEFAULT_ENCODING in case no Charset
has been provided. |
Schema |
toSchema() |
Retrieves the
Schema representing the Transmission . |
org.refcodes.struct.SimpleTypeMap |
toSimpleTypeMap() |
Returns the
SimpleTypeMap representation of this
Transmission . |
String |
toString() |
|
Sequence |
toTransmission() |
Provides the
Sequence representation of this
Transmission . |
letMagicBytes, letMagicBytes
letMagicBytes
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
fromInputStream, getLength, transmitTo, transmitTo
transmitTo
public static final String MAGIC_BYTES
public static final String MAGIC_BYTES_TEXT
protected byte[] _magicBytes
protected int _magicBytesLength
protected String _charset
protected String _alias
public AbstractMagicBytesTransmission(String aAlias, TransmissionMetrics aTransmissionMetrics)
TransmissionMetrics
configuration object, though only those attributes are supported which
are also supported by the other constructors!aAlias
- The alias which identifies the content of this segment.aTransmissionMetrics
- The TransmissionMetrics
to be used
for configuring this instance.public AbstractMagicBytesTransmission(String aAlias, int aMagicBytesLength)
AbstractMagicBytesTransmission
for magic bytes of
the given length.aAlias
- The alias which identifies the content of this segment.aMagicBytesLength
- The length of the magic bytes sequence.public AbstractMagicBytesTransmission(String aAlias, String aMagicBytes)
AbstractMagicBytesTransmission
with the according
magic bytes (retrieved from the given String
).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).public AbstractMagicBytesTransmission(String aAlias, String aMagicBytes, Charset aCharset)
AbstractMagicBytesTransmission
with the according
magic bytes (retrieved from the given String
).public AbstractMagicBytesTransmission(String aAlias, byte[] aMagicBytes)
AbstractMagicBytesTransmission
with the according
magic bytes.aAlias
- The alias which identifies the content of this segment.aMagicBytes
- The magic bytes to be stored by this instance.public void setPayload(byte[] aValue)
setMagicBytes(byte[])
. setPayload
in interface org.refcodes.mixin.PayloadAccessor.PayloadMutator<byte[]>
public String getAlias()
getAlias
in interface org.refcodes.mixin.AliasAccessor
public byte[] getMagicBytes()
getMagicBytes
in interface org.refcodes.mixin.MagicBytesAccessor
public void setMagicBytes(byte[] aMagicBytes)
setMagicBytes
in interface org.refcodes.mixin.MagicBytesAccessor.MagicBytesMutator
aMagicBytes
- The according magic bytes to store.public void setMagicBytes(String aMagicBytes)
String
to be stored by
this instance (uses the TransmissionMetrics.DEFAULT_ENCODING
) for
byte conversion).setMagicBytes
in interface org.refcodes.mixin.MagicBytesAccessor.MagicBytesMutator
setMagicBytes
in interface MagicBytesAccessor.MagicBytesMutator
aMagicBytes
- The String from which to copy the according magic
bytes from.public void setMagicBytes(String aMagicBytes, Charset aCharset)
String
to be stored by
this instance.public String toMagicBytesString()
String
representation of the given magic bytes
using the latest provided Charset
for conversion or the
TransmissionMetrics.DEFAULT_ENCODING
in case no Charset
has been provided.String
representation of the magic bytes.public String toMagicBytesString(String aCharset)
String
representation of the given magic bytes
using the provided Charset
for conversion or the
TransmissionMetrics.DEFAULT_ENCODING
in case no Charset
has been provided.public Sequence toTransmission()
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.toTransmission
in interface Transmission
Sequence
.public int getMagicBytesLength()
getMagicBytesLength
in interface MagicBytesLengthAccessor
public byte[] getPayload()
getMagicBytes()
. getPayload
in interface org.refcodes.mixin.PayloadAccessor<byte[]>
public Schema toSchema()
Schema
representing the Transmission
.
Retrieving a Schema
is useful when analyzing and debugging data
structures such as a AllocSectionDecoratorSegment
instance to help
document, learn and verify on the structure (as well as the content) of
that very AllocSectionDecoratorSegment
.toSchema
in interface Transmission
Schema
representation of the implementing type for
debugging and verification (or documentation) purposes.public Charset getEncoding()
getEncoding
in interface org.refcodes.mixin.EncodingAccessor<Charset>
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
SimpleTypeMap
representation of this
Transmission
. In case this Transmission has Transmission
children, then the children are queried as well and contained in the
resulting SimpleTypeMap
. The aliases of the according
Transmission
instances represent the resulting path to a
Transmission
's final simple type.toSimpleTypeMap
in interface Transmission
SimpleTypeMap
representing this Transmission
and (if any) its children, with the according aliases forming the
paths to the Transmission
's values.Copyright © 2021. All rights reserved.