Serializable
, org.refcodes.mixin.AliasAccessor
, 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[]>
, Segment
, Segment.SegmentMixin
, Transmission
, Transmission.TransmissionMixin
AssertMagicBytesSegment
public class MagicBytesSegment extends AbstractMagicBytesTransmission implements Segment.SegmentMixin, Segment
MagicBytesSegment
decorates a Segment
decoratee and
prefixes this Segment
instance with given 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>
Segment.SegmentMixin
Transmission.TransmissionMixin
_alias, _charset, _magicBytes, _magicBytesLength, MAGIC_BYTES, MAGIC_BYTES_TEXT
Constructor | Description |
---|---|
MagicBytesSegment(byte... aMagicBytes) |
Constructs an according instance with the according magic bytes.
|
MagicBytesSegment(int aMagicBytesLength) |
Constructs an according instance with magic bytes of the given length.
|
MagicBytesSegment(String aMagicBytes) |
Constructs an according instance with the according magic bytes
(retrieved from the given
String ). |
MagicBytesSegment(String aAlias,
byte... aMagicBytes) |
Constructs an according instance with the according magic bytes.
|
MagicBytesSegment(String aAlias,
int aMagicBytesLength) |
Constructs an according instance with magic bytes of the given length.
|
MagicBytesSegment(String aAlias,
String aMagicBytes) |
Constructs an according instance with the according magic bytes
(retrieved from the given
String ). |
MagicBytesSegment(String aAlias,
String aMagicBytes,
Charset aCharset) |
Constructs an according instance with the according magic bytes
(retrieved from the given
String ). |
MagicBytesSegment(String aMagicBytes,
Charset aCharset) |
Constructs an according instance with the according magic bytes
(retrieved from the given
String ). |
MagicBytesSegment(String aAlias,
TransmissionMetrics aTransmissionMetrics) |
Enriches the provided decoratee with magic bytes of the given length to
be prefixed.
|
Modifier and Type | Method | Description |
---|---|---|
int |
fromTransmission(Sequence aSequence,
int aOffset) |
(Re-)initializes this instance with the the given
Sequence data. |
int |
getLength() |
Determines the overall length of this
Transmission . |
Sequence |
toTransmission() |
Provides the
Sequence representation of this
Transmission . |
MagicBytesSegment |
withPayload(byte[] aValue) |
equals, getAlias, getEncoding, getMagicBytes, getMagicBytesLength, getPayload, hashCode, setMagicBytes, setMagicBytes, setMagicBytes, setPayload, toMagicBytesString, toMagicBytesString, toSchema, toSimpleTypeMap, toString
letMagicBytes, letMagicBytes
letMagicBytes
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFrom
receiveFrom
fromInputStream, toSchema, toSimpleTypeMap, transmitTo, transmitTo
transmitTo
public MagicBytesSegment(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 MagicBytesSegment(int aMagicBytesLength)
aMagicBytesLength
- The length of the magic bytes sequence..public MagicBytesSegment(String aMagicBytes)
String
).aMagicBytes
- The String
to be stored by this instance as
magic bytes (uses the
TransmissionMetrics.DEFAULT_ENCODING
) for byte
conversion).public MagicBytesSegment(String aMagicBytes, Charset aCharset)
String
).public MagicBytesSegment(byte... aMagicBytes)
aMagicBytes
- The magic bytes to be stored by this instance.public MagicBytesSegment(String aAlias, int aMagicBytesLength)
aAlias
- The alias which identifies the content of this segment.aMagicBytesLength
- The length of the magic bytes sequence..public MagicBytesSegment(String aAlias, String aMagicBytes)
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 MagicBytesSegment(String aAlias, String aMagicBytes, Charset aCharset)
String
).public MagicBytesSegment(String aAlias, byte... aMagicBytes)
aAlias
- The alias which identifies the content of this segment.aMagicBytes
- The magic bytes to be stored by this instance.public int fromTransmission(Sequence aSequence, int aOffset) throws TransmissionException
Sequence
data.fromTransmission
in interface Segment
aSequence
- The Sequence
data from which to (re-)initialize
this instance.aOffset
- The offset where to start processing the provided
Sequence
.Sequence
processed by this method.TransmissionException
- thrown in case a given Sequence
cannot be processed.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
toTransmission
in class AbstractMagicBytesTransmission
Sequence
.public int getLength()
Transmission
. In case of
nested Transmission
instances, all length values from all
sub-segments are accumulated to the result as well.getLength
in interface org.refcodes.mixin.LengthAccessor
getLength
in interface Transmission
Transmission
(including any
sub-segments).public MagicBytesSegment withPayload(byte[] aValue)
withPayload
in interface org.refcodes.mixin.PayloadAccessor.PayloadBuilder<T,PayloadTransmission<T>>
Copyright © 2021. All rights reserved.