Module org.refcodes.serial
Package org.refcodes.serial
Class CrcSectionDecorator<DECORATEE extends Section>
java.lang.Object
org.refcodes.numerical.AbstractCrcMixin
org.refcodes.serial.AbstractCrcTransmissionDecorator<DECORATEE>
org.refcodes.serial.CrcSectionDecorator<DECORATEE>
- Type Parameters:
DECORATEE- The decoratee type describing the according subclass to be enriched with a CRC checksum.
- All Implemented Interfaces:
Serializable,org.refcodes.mixin.DecorateeAccessor<DECORATEE>,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.Resetable,org.refcodes.numerical.ChecksumValidationModeAccessor,org.refcodes.numerical.CrcAlgorithmAccessor,org.refcodes.numerical.CrcChecksumAccessor,org.refcodes.numerical.CrcChecksumConcatenateModeAccessor,org.refcodes.numerical.CrcMixin,org.refcodes.numerical.EndianessAccessor,org.refcodes.schema.Schemable,DecoratorSection<DECORATEE>,Section,Transmission,Transmission.TransmissionMixin
public class CrcSectionDecorator<DECORATEE extends Section>
extends AbstractCrcTransmissionDecorator<DECORATEE>
implements DecoratorSection<DECORATEE>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.numerical.ChecksumValidationModeAccessor
org.refcodes.numerical.ChecksumValidationModeAccessor.ChecksumValidationModeBuilder<B extends org.refcodes.numerical.ChecksumValidationModeAccessor.ChecksumValidationModeBuilder<B>>, org.refcodes.numerical.ChecksumValidationModeAccessor.ChecksumValidationModeMutator, org.refcodes.numerical.ChecksumValidationModeAccessor.ChecksumValidationModePropertyNested classes/interfaces inherited from interface org.refcodes.numerical.CrcAlgorithmAccessor
org.refcodes.numerical.CrcAlgorithmAccessor.CrcAlgorithmBuilder<B extends org.refcodes.numerical.CrcAlgorithmAccessor.CrcAlgorithmBuilder<B>>, org.refcodes.numerical.CrcAlgorithmAccessor.CrcAlgorithmMutator, org.refcodes.numerical.CrcAlgorithmAccessor.CrcAlgorithmPropertyNested classes/interfaces inherited from interface org.refcodes.numerical.CrcChecksumAccessor
org.refcodes.numerical.CrcChecksumAccessor.CrcChecksumBuilder<B extends org.refcodes.numerical.CrcChecksumAccessor.CrcChecksumBuilder<B>>, org.refcodes.numerical.CrcChecksumAccessor.CrcChecksumMutator, org.refcodes.numerical.CrcChecksumAccessor.CrcChecksumPropertyNested classes/interfaces inherited from interface org.refcodes.numerical.CrcChecksumConcatenateModeAccessor
org.refcodes.numerical.CrcChecksumConcatenateModeAccessor.CrcChecksumConcatenateModeBuilder<B extends org.refcodes.numerical.CrcChecksumConcatenateModeAccessor.CrcChecksumConcatenateModeBuilder<B>>, org.refcodes.numerical.CrcChecksumConcatenateModeAccessor.CrcChecksumConcatenateModeMutator, org.refcodes.numerical.CrcChecksumConcatenateModeAccessor.CrcChecksumConcatenateModePropertyNested classes/interfaces inherited from interface org.refcodes.mixin.DecorateeAccessor
org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE extends Object,B extends org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE, B>>, org.refcodes.mixin.DecorateeAccessor.DecorateeMutator<DECORATEE extends Object>, org.refcodes.mixin.DecorateeAccessor.DecorateeProperty<DECORATEE extends Object> Nested classes/interfaces inherited from interface org.refcodes.numerical.EndianessAccessor
org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B extends org.refcodes.numerical.EndianessAccessor.EndianessBuilder<B>>, org.refcodes.numerical.EndianessAccessor.EndianessMutator, org.refcodes.numerical.EndianessAccessor.EndianessPropertyNested 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.serial.Section
Section.SectionMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Field Summary
Fields inherited from class org.refcodes.serial.AbstractCrcTransmissionDecorator
_crcChecksum, _decoratee, CRC_ALGORITHM, CRC_BYTE_WIDTH, CRC_CHECKSUM, CRC_CHECKSUM_BIG_ENDIAN_BYTES, CRC_CHECKSUM_CONCATENATION_MODE, CRC_CHECKSUM_HEX, CRC_CHECKSUM_LITTLE_ENDIAN_BYTES, CRC_ENDIANESSFields inherited from class org.refcodes.numerical.AbstractCrcMixin
_checksumValidationMode, _crcAlgorithm, _crcChecksumConcatenateMode, _endianess -
Constructor Summary
ConstructorsConstructorDescriptionCrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.Endianess aEndianess) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode, org.refcodes.numerical.Endianess aEndianess) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.Endianess aEndianess) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode, org.refcodes.numerical.Endianess aEndianess) CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.Endianess aEndianess) CrcSectionDecorator(DECORATEE aDecoratee, TransmissionMetrics aTransmissionMetrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidfromTransmission(Sequence aSequence, int aOffset, int aLength) (Re-)initializes this instance with the the givenSequencedata.voidreceiveFrom(InputStream aInputStream, int aLength, OutputStream aReturnStream) (Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream.Methods inherited from class org.refcodes.serial.AbstractCrcTransmissionDecorator
equals, getCrcChecksum, getDecoratee, getLength, hashCode, reset, toSchema, toSequence, toSimpleTypeMap, toString, transmitToMethods inherited from class org.refcodes.numerical.AbstractCrcMixin
getChecksumValidationMode, getCrcAlgorithm, getCrcChecksumConcatenateMode, getEndianessMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.mixin.DecorateeAccessor
getDecorateeMethods inherited from interface org.refcodes.serial.Section
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
getLength, reset, toSchema, toSequence, toSimpleTypeMap, transmitTo, transmitTo
-
Constructor Details
-
CrcSectionDecorator
-
CrcSectionDecorator
-
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.Endianess aEndianess) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode, org.refcodes.numerical.Endianess aEndianess) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.Endianess aEndianess) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.Endianess aEndianess) -
CrcSectionDecorator
public CrcSectionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm, org.refcodes.mixin.ConcatenateMode aCrcChecksumConcatenateMode, org.refcodes.numerical.ChecksumValidationMode aChecksumValidationMode, org.refcodes.numerical.Endianess aEndianess)
-
-
Method Details
-
fromTransmission
public void fromTransmission(Sequence aSequence, int aOffset, int aLength) throws TransmissionException (Re-)initializes this instance with the the givenSequencedata.- Specified by:
fromTransmissionin interfaceSection- Parameters:
aSequence- TheSequencedata from which to (re-)initialize this instance.aOffset- The offset where to start processing the providedSequence.aLength- The length of data assigned by theSequence.- Throws:
BadCrcChecksumSequenceException- thrown in case the CRC checksum validation failed.TransmissionException- thrown in case a givenSequencecannot be processed.
-
receiveFrom
public void receiveFrom(InputStream aInputStream, int aLength, OutputStream aReturnStream) throws IOException (Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream. Implementations providing error correction methods use the provided feedbackOutputStreamto do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the received data.- Specified by:
receiveFromin interfaceSection- Parameters:
aInputStream- TheInputStreamfrom which to read the instance's (re-)initializationSequencefrom.aLength- The length of data assigned by the byte array.aReturnStream- AnOutputStreambeing the return channel to handle "stop-and-wait ARQ" or the like in case of a bidirectional connection. Can be null in case we have a unidirectional connection.- Throws:
BadCrcChecksumException- thrown in case the CRC checksum validation failed.IOException- thrown in case reading data from theInputStreamcaused problems.TransmissionException- thrown in case a givenInputStreambytes cannot be processed.
-