Class CRCUtil
java.lang.Object
com.inductiveautomation.ignition.common.util.CRCUtil
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
calcCRC
(byte[] arr) Calculates a CRC for the byte array.static long
Calculates the CRC of a file.static <T> long
crc
(Collection<T> items) This is a convenience method that will use whatever T.hashCode() happens to be as the hash code.static <T> long
crc
(Collection<T> items, CRCUtil.HashCoder<T> hashCoder) Calculates a reliably unique code for a given Collection<T> that is indifferent to the collections lack of order.
-
Constructor Details
-
CRCUtil
public CRCUtil()
-
-
Method Details
-
calcCRC
public static long calcCRC(byte[] arr) Calculates a CRC for the byte array. If the array is null or has length==0, returns 0. -
calcCRC
Calculates the CRC of a file. Avoids loading the whole file into memory- Throws:
IOException
-
crc
This is a convenience method that will use whatever T.hashCode() happens to be as the hash code.- See Also:
-
crc
Calculates a reliably unique code for a given Collection<T> that is indifferent to the collections lack of order.- Parameters:
items
- The Collection<T> you want a CRC for.hashCoder
- The HashCoder that provides a hashCode for an object of T.- Returns:
- A CRC for the given Collection<T>.
-