java.lang.Object
org.refcodes.serial.AbstractMagicBytesTransmission
org.refcodes.serial.MagicBytesSegment
org.refcodes.serial.AssertMagicBytesSegment
- All Implemented Interfaces:
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<byte[],,PayloadTransmission<byte[]>> org.refcodes.mixin.PayloadAccessor.PayloadMutator<byte[]>,org.refcodes.mixin.PayloadAccessor.PayloadProperty<byte[]>,org.refcodes.mixin.Resetable,org.refcodes.schema.Schemable,MagicBytesAccessor,MagicBytesAccessor.MagicBytesMutator,MagicBytesAccessor.MagicBytesProperty,MagicBytesLengthAccessor,PayloadTransmission<byte[]>,Segment,Segment.SegmentMixin,Transmission,Transmission.TransmissionMixin
The
AssertMagicBytesSegment extends the MagicBytesSegment and
enforces the configured magic bytes to match the received magic bytes (as of
Segment.fromTransmission(Sequence) and
Segment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream) or the like).
In case the assertion of the configured magic bytes fails during receiving,
then a BadMagicBytesException or
BadMagicBytesSequenceException is thrown.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor
org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.EncodingAccessor
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> Nested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.MagicBytesAccessor
org.refcodes.mixin.MagicBytesAccessor.MagicBytesBuilder<B extends org.refcodes.mixin.MagicBytesAccessor.MagicBytesBuilder<B>>, org.refcodes.mixin.MagicBytesAccessor.MagicBytesMutator, org.refcodes.mixin.MagicBytesAccessor.MagicBytesPropertyNested classes/interfaces inherited from interface org.refcodes.serial.MagicBytesAccessor
MagicBytesAccessor.MagicBytesBuilder<B extends MagicBytesAccessor.MagicBytesBuilder<B>>, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesPropertyNested classes/interfaces inherited from interface org.refcodes.serial.MagicBytesLengthAccessor
MagicBytesLengthAccessor.MagicBytesLengthBuilder<B extends MagicBytesLengthAccessor.MagicBytesLengthBuilder<B>>, MagicBytesLengthAccessor.MagicBytesLengthMutator, MagicBytesLengthAccessor.MagicBytesLengthPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.PayloadAccessor
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> Nested classes/interfaces inherited from interface org.refcodes.serial.Segment
Segment.SegmentMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Field Summary
Fields inherited from class org.refcodes.serial.AbstractMagicBytesTransmission
_alias, _charset, _magicBytes, _magicBytesLength, MAGIC_BYTES, MAGIC_BYTES_TEXT -
Constructor Summary
ConstructorsConstructorDescriptionAssertMagicBytesSegment(byte... aMagicBytes) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes.AssertMagicBytesSegment(byte[] aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes.AssertMagicBytesSegment(String aMagicBytes) Constructs anAssertMagicBytesSegmentwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(String aAlias, byte... aMagicBytes) Constructs anAssertMagicBytesSegmentwith the according magic bytes.AssertMagicBytesSegment(String aAlias, byte[] aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAssertMagicBytesSegmentwith the according magic bytes.AssertMagicBytesSegment(String aAlias, String aMagicBytes) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(String aAlias, String aMagicBytes, Charset aCharset) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(String aAlias, String aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(String aMagicBytes, Charset aCharset) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(String aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString).AssertMagicBytesSegment(TransmissionMetrics aTransmissionMetrics) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). -
Method Summary
Modifier and TypeMethodDescriptionintfromTransmission(Sequence aSequence, int aOffset) (Re-)initializes this instance with the the givenSequencedata.toSchema()Methods inherited from class org.refcodes.serial.MagicBytesSegment
getLength, toSequence, withPayloadMethods inherited from class org.refcodes.serial.AbstractMagicBytesTransmission
equals, getAlias, getEncoding, getMagicBytes, getMagicBytesLength, getPayload, hashCode, reset, setMagicBytes, setMagicBytes, setMagicBytes, setPayload, toMagicBytesString, toMagicBytesString, toSimpleTypeMap, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.serial.MagicBytesAccessor
toMagicBytes, toMagicBytesMethods inherited from interface org.refcodes.mixin.MagicBytesAccessor.MagicBytesProperty
letMagicBytes, letMagicBytesMethods inherited from interface org.refcodes.serial.MagicBytesAccessor.MagicBytesProperty
letMagicBytesMethods inherited from interface org.refcodes.mixin.PayloadAccessor
getPayloadOrMethods inherited from interface org.refcodes.mixin.PayloadAccessor.PayloadProperty
letPayloadMethods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Segment.SegmentMixin
receiveFromMethods inherited from interface org.refcodes.serial.Transmission
reset, toSimpleTypeMap, transmitTo, transmitToMethods inherited from interface org.refcodes.serial.Transmission.TransmissionMixin
transmitTo
-
Constructor Details
-
AssertMagicBytesSegment
public AssertMagicBytesSegment(String aAlias, String aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aAlias- The alias which identifies the content of this segment.aMagicBytes- TheStringto be stored by this instance as magic bytes.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AssertMagicBytesSegment
public AssertMagicBytesSegment(String aAlias, byte[] aMagicBytes, TransmissionMetrics aTransmissionMetrics) Constructs anAssertMagicBytesSegmentwith the according magic bytes. Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aAlias- The alias which identifies the content of this segment.aMagicBytes- The bytes to be stored by this instance as magic bytes.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aMagicBytes- TheStringto be stored by this instance as magic bytes.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes. Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aMagicBytes- The bytes to be stored by this instance as magic bytes.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
AssertMagicBytesSegment
public AssertMagicBytesSegment(byte... aMagicBytes) Constructs anAbstractMagicBytesTransmissionwith the according magic bytes. Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aMagicBytes- The magic bytes to be stored by this instance.
-
AssertMagicBytesSegment
Constructs anAssertMagicBytesSegmentwith the according magic bytes. Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aAlias- The alias which identifies the content of this segment.aMagicBytes- The magic bytes to be stored by this instance.
-
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown. -
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown. -
AssertMagicBytesSegment
Constructs anAbstractMagicBytesTransmissionwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aAlias- The alias which identifies the content of this segment.aMagicBytes- TheStringto be stored by this instance as magic bytes.
-
AssertMagicBytesSegment
Constructs anAssertMagicBytesSegmentwith the according magic bytes (retrieved from the givenString). Enforces the configured magic bytes to match the received magic bytes (as ofSegment.fromTransmission(Sequence)andSegment.SegmentMixin.receiveFrom(java.io.InputStream, java.io.OutputStream)or the like). In case the assertion of the configured magic bytes fails during receiving, then aBadMagicBytesExceptionorBadMagicBytesSequenceExceptionis thrown.- Parameters:
aMagicBytes- TheStringto be stored by this instance as magic bytes.
-
-
Method Details
-
fromTransmission
(Re-)initializes this instance with the the givenSequencedata.- Specified by:
fromTransmissionin interfaceSegment- Overrides:
fromTransmissionin classMagicBytesSegment- Parameters:
aSequence- TheSequencedata from which to (re-)initialize this instance.aOffset- The offset where to start processing the providedSequence.- Returns:
- The index after the last offset into the given
Sequenceprocessed by this method. - Throws:
TransmissionException- thrown in case a givenSequencecannot be processed.
-
toSchema
- Specified by:
toSchemain interfaceorg.refcodes.schema.Schemable- Specified by:
toSchemain interfaceTransmission- Overrides:
toSchemain classAbstractMagicBytesTransmission
-