- java.lang.Object
-
- java.lang.Enum<CrcAlgorithmConfig>
-
- org.refcodes.numerical.CrcAlgorithmConfig
-
- All Implemented Interfaces:
Serializable
,Comparable<CrcAlgorithmConfig>
,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 interface org.refcodes.numerical.CrcWidthAccessor
CrcWidthAccessor.CrcWidthBuilder<B extends CrcWidthAccessor.CrcWidthBuilder<B>>, CrcWidthAccessor.CrcWidthMutator, CrcWidthAccessor.CrcWidthProperty
-
-
Enum Constant Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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 Detail
-
CRC_8
public static final CrcAlgorithmConfig CRC_8
-
CRC_8_ARDUINO
public static final CrcAlgorithmConfig CRC_8_ARDUINO
-
CRC_8_CCITT
public static final CrcAlgorithmConfig CRC_8_CCITT
-
CRC_8_CDMA2000
public static final CrcAlgorithmConfig CRC_8_CDMA2000
-
CRC_8_DARC
public static final CrcAlgorithmConfig CRC_8_DARC
-
CRC_8_DVBS2
public static final CrcAlgorithmConfig CRC_8_DVBS2
-
CRC_8_SAE_J1850
public static final CrcAlgorithmConfig CRC_8_SAE_J1850
-
CRC_8_EBU
public static final CrcAlgorithmConfig CRC_8_EBU
-
CRC_8_ICODE
public static final CrcAlgorithmConfig CRC_8_ICODE
-
CRC_8_ITU
public static final CrcAlgorithmConfig CRC_8_ITU
-
CRC_8_MAXIM
public static final CrcAlgorithmConfig CRC_8_MAXIM
-
CRC_8_ROHC
public static final CrcAlgorithmConfig CRC_8_ROHC
-
CRC_8_WCDMA
public static final CrcAlgorithmConfig CRC_8_WCDMA
-
CRC_16_CCITT_FALSE
public static final CrcAlgorithmConfig CRC_16_CCITT_FALSE
-
CRC_16_ARC
public static final CrcAlgorithmConfig CRC_16_ARC
-
CRC_16_AUG_CCITT
public static final CrcAlgorithmConfig CRC_16_AUG_CCITT
-
CRC_16_BUYPASS
public static final CrcAlgorithmConfig CRC_16_BUYPASS
-
CRC_16_CDMA2000
public static final CrcAlgorithmConfig CRC_16_CDMA2000
-
CRC_16_DDS_110
public static final CrcAlgorithmConfig CRC_16_DDS_110
-
CRC_16_DECT_R
public static final CrcAlgorithmConfig CRC_16_DECT_R
-
CRC_16_DECT_X
public static final CrcAlgorithmConfig CRC_16_DECT_X
-
CRC_16_DNP
public static final CrcAlgorithmConfig CRC_16_DNP
-
CRC_16_EN_13757
public static final CrcAlgorithmConfig CRC_16_EN_13757
-
CRC_16_GENIBUS
public static final CrcAlgorithmConfig CRC_16_GENIBUS
-
CRC_16_MAXIM
public static final CrcAlgorithmConfig CRC_16_MAXIM
-
CRC_16_MCRF4XX
public static final CrcAlgorithmConfig CRC_16_MCRF4XX
-
CRC_16_RIELLO
public static final CrcAlgorithmConfig CRC_16_RIELLO
-
CRC_16_T10_DIF
public static final CrcAlgorithmConfig CRC_16_T10_DIF
-
CRC_16_TELEDISK
public static final CrcAlgorithmConfig CRC_16_TELEDISK
-
CRC_16_TMS37157
public static final CrcAlgorithmConfig CRC_16_TMS37157
-
CRC_16_USB
public static final CrcAlgorithmConfig CRC_16_USB
-
CRC_16_A
public static final CrcAlgorithmConfig CRC_16_A
-
CRC_16_KERMIT
public static final CrcAlgorithmConfig CRC_16_KERMIT
-
CRC_16_MODBUS
public static final CrcAlgorithmConfig CRC_16_MODBUS
-
CRC_16_X25
public static final CrcAlgorithmConfig CRC_16_X25
-
CRC_16_XMODEM
public static final CrcAlgorithmConfig CRC_16_XMODEM
-
CRC_32
public static final CrcAlgorithmConfig CRC_32
-
CRC_32_BZIP2
public static final CrcAlgorithmConfig CRC_32_BZIP2
-
CRC_32_C
public static final CrcAlgorithmConfig CRC_32_C
-
CRC_32_D
public static final CrcAlgorithmConfig CRC_32_D
-
CRC_32_JAMCRC
public static final CrcAlgorithmConfig CRC_32_JAMCRC
-
CRC_32_MPEG2
public static final CrcAlgorithmConfig CRC_32_MPEG2
-
CRC_32_POSIX
public static final CrcAlgorithmConfig CRC_32_POSIX
-
CRC_32_Q
public static final CrcAlgorithmConfig CRC_32_Q
-
CRC_32_XFER
public static final CrcAlgorithmConfig CRC_32_XFER
-
CRC_64
public static final CrcAlgorithmConfig CRC_64
-
CRC_64_WE
public static final CrcAlgorithmConfig CRC_64_WE
-
CRC_64_XZ
public static final CrcAlgorithmConfig CRC_64_XZ
-
-
Method Detail
-
values
public static CrcAlgorithmConfig[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CrcAlgorithmConfig c : CrcAlgorithmConfig.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CrcAlgorithmConfig valueOf(String name)
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
public String 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
public byte[] toCrcBytes(byte aData, Endianess aEndianess)
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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- 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
public CrcSize getCrcSize()
Gets theCrcSize
class to which thisCrcAlgorithm
belongs.- Specified by:
getCrcSize
in interfaceCrcAlgorithm
- Returns:
- The
CrcSize
enumeration providing various width related methods.
-
-