类 Checksum
java.lang.Object
net.sf.marineapi.nmea.sentence.Checksum
Provides Sentence checksum calculation and utilities.
- 作者:
- Kimmo Tuukkanen
-
方法详细资料
-
add
Append or replace existing checksum in specified NMEA sentence.- 参数:
nmea- Sentence in String representation- 返回:
- The specified String with checksum added.
-
calculate
Calculates checksum for given NMEA sentence, i.e. XOR of each character between '$' and '*' characters (exclusive).- 参数:
nmea- Sentence String with or without checksum.- 返回:
- Hexadecimal checksum
-
xor
Calculates XOR checksum of given String. Resulting hex value is returned as a String in two digit format, padded with a leading zero if necessary.- 参数:
str- String to calculate checksum for.- 返回:
- Hexadecimal checksum
-
index
Returns the index of checksum separator char in specified NMEA sentence. If separator is not found, returns the String length.- 参数:
nmea- Sentence String- 返回:
- Index of checksum separator or String length.
-