- All Implemented Interfaces:
Serializable
,Comparable<CrcAlgorithmConfig>
,java.lang.constant.Constable
,org.refcodes.mixin.NameAccessor
,CrcAlgorithm
,CrcWidthAccessor
public enum CrcAlgorithmConfig extends Enum<CrcAlgorithmConfig> implements CrcAlgorithm
Enumeration with CRC implementations hacked together from sources "out
there".
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface org.refcodes.numerical.CrcWidthAccessor
CrcWidthAccessor.CrcWidthBuilder<B extends CrcWidthAccessor.CrcWidthBuilder<B>>, CrcWidthAccessor.CrcWidthMutator, CrcWidthAccessor.CrcWidthProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.NameAccessor
org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description CrcSize
getCrcSize()
Gets theCrcSize
class to which thisCrcAlgorithm
belongs.int
getCrcWidth()
Retrieves the value from the CRC byte width (number of bytes used to store a CRC checksum) property.String
getName()
byte[]
toCrcBytes(byte[] aData, int aOffset, int aLength, Endianess aEndianess)
Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.byte[]
toCrcBytes(byte[] aData, Endianess aEndianess)
Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.byte[]
toCrcBytes(byte aData, Endianess aEndianess)
Calculates the according checksum from the supplied data and returns the according byte array of the CRC checksum.byte[]
toCrcBytes(long aCrc, byte[] aData, int aOffset, int aLength, Endianess aEndianess)
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.byte[]
toCrcBytes(long aCrc, byte[] aData, Endianess aEndianess)
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.byte[]
toCrcBytes(long aCrc, byte aData, Endianess aEndianess)
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.long
toCrcChecksum(byte aData)
Calculates the according checksum from the supplied data.long
toCrcChecksum(byte[] aData)
Calculates the according checksum from the supplied data.long
toCrcChecksum(byte[] aData, int aOffset, int aLength)
Calculates the according checksum from the supplied data.long
toCrcChecksum(long aCrc, byte aData)
Updates the according checksum with he supplied data.long
toCrcChecksum(long aCrc, byte[] aData)
Updates the according checksum with he supplied data.long
toCrcChecksum(long aCrc, byte[] aData, int aOffset, int aLength)
Updates the according checksum with he supplied data.static CrcAlgorithmConfig
valueOf(String name)
Returns the enum constant of this type with the specified name.static CrcAlgorithmConfig[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CRC_8
-
CRC_8_ARDUINO
-
CRC_8_CCITT
-
CRC_8_CDMA2000
-
CRC_8_DARC
-
CRC_8_DVBS2
-
CRC_8_SAE_J1850
-
CRC_8_EBU
-
CRC_8_ICODE
-
CRC_8_ITU
-
CRC_8_MAXIM
-
CRC_8_ROHC
-
CRC_8_WCDMA
-
CRC_16_CCITT_FALSE
-
CRC_16_ARC
-
CRC_16_AUG_CCITT
-
CRC_16_BUYPASS
-
CRC_16_CDMA2000
-
CRC_16_DDS_110
-
CRC_16_DECT_R
-
CRC_16_DECT_X
-
CRC_16_DNP
-
CRC_16_EN_13757
-
CRC_16_GENIBUS
-
CRC_16_MAXIM
-
CRC_16_MCRF4XX
-
CRC_16_RIELLO
-
CRC_16_T10_DIF
-
CRC_16_TELEDISK
-
CRC_16_TMS37157
-
CRC_16_USB
-
CRC_16_A
-
CRC_16_KERMIT
-
CRC_16_MODBUS
-
CRC_16_X25
-
CRC_16_XMODEM
-
CRC_32
-
CRC_32_BZIP2
-
CRC_32_C
-
CRC_32_D
-
CRC_32_JAMCRC
-
CRC_32_MPEG2
-
CRC_32_POSIX
-
CRC_32_Q
-
CRC_32_XFER
-
CRC_64
-
CRC_64_WE
-
CRC_64_XZ
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
toCrcChecksum
public long toCrcChecksum(byte aData)Calculates the according checksum from the supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.- Returns:
- The according checksum.
-
getName
- Specified by:
getName
in interfaceorg.refcodes.mixin.NameAccessor
-
getCrcWidth
public int getCrcWidth()Retrieves the value from the CRC byte width (number of bytes used to store a CRC checksum) property.- Specified by:
getCrcWidth
in interfaceCrcWidthAccessor
- Returns:
- The name stored by the CRC byte width (number of bytes used to store a CRC checksum) property.
-
toCrcChecksum
public long toCrcChecksum(long aCrc, byte aData)Updates the according checksum with he supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.- Returns:
- The accordingly updated checksum.
-
toCrcChecksum
public long toCrcChecksum(byte[] aData)Calculates the according checksum from the supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.- Returns:
- The according checksum.
-
toCrcChecksum
public long toCrcChecksum(long aCrc, byte[] aData)Updates the according checksum with he supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.- Returns:
- The accordingly updated checksum.
-
toCrcChecksum
public long toCrcChecksum(byte[] aData, int aOffset, int aLength)Calculates the according checksum from the supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.aOffset
- The offset from where to start.aLength
- The number of bytes to cover.- Returns:
- The according checksum.
-
toCrcChecksum
public long toCrcChecksum(long aCrc, byte[] aData, int aOffset, int aLength)Updates the according checksum with he supplied data.- Specified by:
toCrcChecksum
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.aOffset
- The offset from where to start.aLength
- The number of bytes to cover.- Returns:
- The accordingly updated checksum.
-
toCrcBytes
Calculates the according checksum from the supplied data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The according checksum.
-
toCrcBytes
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The accordingly updated checksum.
-
toCrcBytes
Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The according checksum.
-
toCrcBytes
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The accordingly updated checksum.
-
toCrcBytes
Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aData
- The data for which to calculate the checksum.aOffset
- The offset from where to start.aLength
- The number of bytes to cover.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The according checksum.
-
toCrcBytes
Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.- Specified by:
toCrcBytes
in interfaceCrcAlgorithm
- Parameters:
aCrc
- The CRC checksum to be updated.aData
- The data for which to calculate the checksum.aOffset
- The offset from where to start.aLength
- The number of bytes to cover.aEndianess
- TheEndianess
(big endian or little endian) of the resulting bytes representing the CRC checksum.- Returns:
- The accordingly updated checksum.
-
getCrcSize
Gets theCrcSize
class to which thisCrcAlgorithm
belongs.- Specified by:
getCrcSize
in interfaceCrcAlgorithm
- Returns:
- The
CrcSize
enumeration providing various width related methods.
-