com.eyebolt.iplib
Class CRCCalc

java.lang.Object
  |
  +--com.eyebolt.iplib.CRCCalc

class CRCCalc
extends java.lang.Object

Encapsulate operations to calculate CRC on some object.

Version:
0.01, 12 Feb 1998
Author:
John Gardner

Field Summary
(package private) static short CRC_NORMAL
           
(package private) static int CRC16
           
(package private) static short[] crctab
           
(package private)  int crctype
           
(package private)  boolean firsttime
           
(package private)  int shortCount
          keep track of # of shorts; add an extra before a long
(package private)  short value
           
 
Constructor Summary
CRCCalc()
          Constructs a CRCCalc
 
Method Summary
(package private)  short crchware(short data, int genpoly, short accum)
          Description of the Method
(package private)  short crcrevhware(short data, int genpoly, short accum)
          Description of the Method
(package private)  void crcrevupdate(short data)
          Description of the Method
(package private)  void crcupdate(short data)
          Description of the Method
 long getValue()
          Gets the Value attribute of the CRCCalc object
(package private)  short[] mk_crctbl(int poly)
          Description of the Method
 void update(byte[] bytes)
          Add some bytes to the CRC to be calculated
 void updateInteger(int val)
          Add an integer value to the CRC to be calculated
 void updateShort(short s)
          Add a short value to the CRC to be calculated
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

crctype

int crctype

value

short value

firsttime

boolean firsttime

shortCount

int shortCount
keep track of # of shorts; add an extra before a long

CRC16

static final int CRC16

CRC_NORMAL

static final short CRC_NORMAL

crctab

static short[] crctab
Constructor Detail

CRCCalc

public CRCCalc()
Constructs a CRCCalc
Method Detail

getValue

public long getValue()
Gets the Value attribute of the CRCCalc object
Returns:
The Value value

updateInteger

public void updateInteger(int val)
Add an integer value to the CRC to be calculated
Parameters:
val - the int to add

updateShort

public void updateShort(short s)
Add a short value to the CRC to be calculated
Parameters:
s - the short to add

update

public void update(byte[] bytes)
Add some bytes to the CRC to be calculated
Parameters:
bytes - the bytes to add

crcrevhware

short crcrevhware(short data,
                  int genpoly,
                  short accum)
Description of the Method
Parameters:
data - Description of Parameter
genpoly - Description of Parameter
accum - Description of Parameter
Returns:
Description of the Returned Value

crchware

short crchware(short data,
               int genpoly,
               short accum)
Description of the Method
Parameters:
data - Description of Parameter
genpoly - Description of Parameter
accum - Description of Parameter
Returns:
Description of the Returned Value

mk_crctbl

short[] mk_crctbl(int poly)
Description of the Method
Parameters:
poly - Description of Parameter
Returns:
Description of the Returned Value

crcupdate

void crcupdate(short data)
Description of the Method
Parameters:
data - Description of Parameter

crcrevupdate

void crcrevupdate(short data)
Description of the Method
Parameters:
data - Description of Parameter


Copyright © 2001 Eyebolt, Inc.