org.opengts.util
Class Checksum

java.lang.Object
  extended by org.opengts.util.Checksum

public class Checksum
extends java.lang.Object

Checksum tools


Nested Class Summary
static class Checksum.CRC
           
 
Constructor Summary
Checksum()
           
 
Method Summary
static long calcChecksum(Checksum.CRC crc, byte[] b, int bOfs, int bLen)
          Returns checksum based on specified algorithm
static int calcCrc16_1(byte[] b)
           
static int calcCrc16_1(byte[] b, int bOfs, int bLen)
           
static int calcCrc16_modbus(byte[] b)
           
static int calcCrc16_modbus(byte[] b, int bOfs, int bLen)
           
static int calcCrc16(byte[] b)
           
static int calcCrc16(byte[] b, int bOfs, int bLen)
           
static long calcCrc32(byte[] b)
           
static long calcCrc32(byte[] b, int bOfs, int bLen)
           
static int calcCrcCCITT_1D0F(byte[] b)
           
static int calcCrcCCITT_1D0F(byte[] b, int bLen)
           
static int calcCrcCCITT_1D0F(byte[] b, int bOfs, int bLen)
           
static int calcCrcCCITT(byte[] b)
           
static int calcCrcCCITT(byte[] b, int bLen)
           
static int calcCrcCCITT(byte[] b, int bOfs, int bLen)
           
static byte calcCrcSum8(byte[] b)
           
static byte calcCrcSum8(byte[] b, int bOfs, int bLen)
           
static int calcCrcXmodem(byte[] b)
           
static int calcCrcXmodem(byte[] b, int bLen)
           
static int calcCrcXmodem(byte[] b, int bOfs, int bLen)
           
static byte calcCrcXOR8(byte[] b)
           
static byte calcCrcXOR8(byte[] b, int bOfs, int bLen)
           
static void main(java.lang.String[] args)
           
static byte TwosCompliment(byte b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checksum

public Checksum()
Method Detail

TwosCompliment

public static byte TwosCompliment(byte b)

calcChecksum

public static long calcChecksum(Checksum.CRC crc,
                                byte[] b,
                                int bOfs,
                                int bLen)
Returns checksum based on specified algorithm

Parameters:
crc - The CRC algorithm
b - The byte array
bOfs - The offset into the byte array to begin CRC
bLen - The number of bytes to include in the CRC

calcCrcCCITT

public static int calcCrcCCITT(byte[] b)

calcCrcCCITT

public static int calcCrcCCITT(byte[] b,
                               int bLen)

calcCrcCCITT

public static int calcCrcCCITT(byte[] b,
                               int bOfs,
                               int bLen)

calcCrcXmodem

public static int calcCrcXmodem(byte[] b)

calcCrcXmodem

public static int calcCrcXmodem(byte[] b,
                                int bLen)

calcCrcXmodem

public static int calcCrcXmodem(byte[] b,
                                int bOfs,
                                int bLen)

calcCrcCCITT_1D0F

public static int calcCrcCCITT_1D0F(byte[] b)

calcCrcCCITT_1D0F

public static int calcCrcCCITT_1D0F(byte[] b,
                                    int bLen)

calcCrcCCITT_1D0F

public static int calcCrcCCITT_1D0F(byte[] b,
                                    int bOfs,
                                    int bLen)

calcCrc16

public static int calcCrc16(byte[] b)

calcCrc16

public static int calcCrc16(byte[] b,
                            int bOfs,
                            int bLen)

calcCrc16_modbus

public static int calcCrc16_modbus(byte[] b)

calcCrc16_modbus

public static int calcCrc16_modbus(byte[] b,
                                   int bOfs,
                                   int bLen)

calcCrc16_1

public static int calcCrc16_1(byte[] b)

calcCrc16_1

public static int calcCrc16_1(byte[] b,
                              int bOfs,
                              int bLen)

calcCrc32

public static long calcCrc32(byte[] b)

calcCrc32

public static long calcCrc32(byte[] b,
                             int bOfs,
                             int bLen)

calcCrcXOR8

public static byte calcCrcXOR8(byte[] b)

calcCrcXOR8

public static byte calcCrcXOR8(byte[] b,
                               int bOfs,
                               int bLen)

calcCrcSum8

public static byte calcCrcSum8(byte[] b)

calcCrcSum8

public static byte calcCrcSum8(byte[] b,
                               int bOfs,
                               int bLen)

main

public static void main(java.lang.String[] args)