|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.protocols.ip.OC16ChecksumProducer
Produces a one's compliment 16-bit checksum from data that is "added" to the sum. The producer handles objects from 8-bits to 64-bit values.
Field Summary | |
private int |
m_cksum
|
private boolean |
m_finalized
|
Constructor Summary | |
OC16ChecksumProducer()
Default constructor. |
Method Summary | |
void |
add(byte b)
Adds the specified 8-bit value to the checksum. |
void |
add(byte a,
byte b)
Adds the specified 8-bit values to the checksum. |
void |
add(int i)
Adds the specified 32-bit value to the checksum. |
void |
add(long l)
Adds the specified 64-bit value to the checksum. |
void |
add(short s)
Adds the specified 16-bit value to the checksum total. |
private static int |
byteToInt(byte b)
Converts a 8-bit value to a 32-bit integer value. |
private void |
finalizeSum()
Finalizes the result by adding the carried out bits back into the checksum. |
short |
getChecksum()
Returns the current checksum value that has been computed for the object. |
void |
reset()
Resets the object to a zero state. |
private static int |
shortToInt(short s)
Converts a 16-bit value to a 32-bit value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int m_cksum
private boolean m_finalized
Constructor Detail |
public OC16ChecksumProducer()
Method Detail |
private static int byteToInt(byte b)
b
- The 8-bit value to convert
private static int shortToInt(short s)
s
- The 16-bit value to convert
private void finalizeSum()
public void add(byte b)
b
- The 8-bit value to add to the checksum.public void add(byte a, byte b)
a
- The high order 8-bitsb
- The low order 8-bitspublic void add(short s)
s
- The 16-bit value to addpublic void add(int i)
i
- The 32-bit value.public void add(long l)
l
- The 64-bit value to addpublic void reset()
public short getChecksum()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |