Enum Class CrcSize

java.lang.Object
java.lang.Enum<CrcSize>
org.refcodes.numerical.CrcSize
All Implemented Interfaces:
Serializable, Comparable<CrcSize>, Constable, CrcWidthAccessor

public enum CrcSize extends Enum<CrcSize> implements CrcWidthAccessor
Enumeration with CRC implementations hacked together from sources "out there".
  • Enum Constant Details

    • CRC_8

      public static final CrcSize CRC_8
    • CRC_16

      public static final CrcSize CRC_16
    • CRC_32

      public static final CrcSize CRC_32
    • CRC_64

      public static final CrcSize CRC_64
  • Method Details

    • values

      public static CrcSize[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CrcSize valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • 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 interface CrcWidthAccessor
      Returns:
      The name stored by the CRC byte width (number of bytes used to store a CRC checksum) property.
    • getCrcAlgorithms

      public CrcAlgorithmConfig[] getCrcAlgorithms()
      Retrieves the CrcAlgorithmConfig implementations as of the according CrcSize.
      Returns:
      The CrcAlgorithmConfig implementations with the according checksum's "CRC byte length"
    • toCrcCategory

      public static CrcSize toCrcCategory(int aCrcByteWidth)
      Retrieves the CrcSize representing the queried "byte length".
      Parameters:
      aCrcByteWidth - The "byte length" for which to retrieve the according CrcSize.
      Returns:
      The according CrcSize or null if none fitting was found.