Open SiteSearch 4.1.1
Final

ORG.oclc.sip
Class SipChecksum

java.lang.Object
  |
  +--ORG.oclc.sip.SipChecksum

public class SipChecksum
extends Object
implements Checksum

The SipChecksum class creates a checksum according to the algorithm specified in the Error Handling section of the 3M Standard Interchange Protocol (Document Revision 2.0, Updated Nov. 11, 1997)

The actual checksum is computed by the update((byte[] b, int off, int len)method, and the String to insert into the SIP message is retrieved using the toHexString() method.


Field Summary
protected  short value
           
 
Constructor Summary
SipChecksum()
          Constructs an SipChecksum object
 
Method Summary
 long getValue()
          Returns the current checksum value.
static void main(String[] args)
          Tests the SipChecksum class
 void reset()
          Resets the checksum to its initial value.
 String toHexString()
          Returns the hex string representation of the checksum value
 void update(byte[] b, int off, int len)
          Updates the current checksum with the specified array of bytes.
 void update(int b)
          Updates the current checksum with the specified byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected short value
Constructor Detail

SipChecksum

public SipChecksum()
Constructs an SipChecksum object
Method Detail

getValue

public long getValue()
Returns the current checksum value.
Specified by:
getValue in interface Checksum
Returns:
long the checksum value

reset

public void reset()
Resets the checksum to its initial value.
Specified by:
reset in interface Checksum

update

public void update(byte[] b,
                   int off,
                   int len)
Updates the current checksum with the specified array of bytes.
Specified by:
update in interface Checksum
Parameters:
b - a byte array
off - where to start in the array
len - how much of the array to use

update

public void update(int b)
Updates the current checksum with the specified byte. ** This method is not implemented **
Specified by:
update in interface Checksum

toHexString

public String toHexString()
Returns the hex string representation of the checksum value
Returns:
a 4-character ascii string of the value of the checksum (in upper case)

main

public static void main(String[] args)
Tests the SipChecksum class

Open SiteSearch 4.1.1
Final