uk.org.retep.util.io
Class CRC16

java.lang.Object
  extended by uk.org.retep.util.io.CRC16
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class CRC16
extends java.lang.Object
implements java.io.Externalizable

A simple 16bit cyclic redundancy check for a set of bytes

Author:
peter
See Also:
Serialized Form

Constructor Summary
CRC16()
           
 
Method Summary
 void add(byte v)
          Add the byte to the CRC
 void add(byte[] b)
          Add the byte[] to the CRC
 void add(byte[] b, int start, int length)
          Add the byte[] to the CRC
 boolean equals(java.lang.Object obj)
           
 int getValue()
           
 int hashCode()
           
 void readExternal(java.io.ObjectInput in)
           
 void reset()
          Reset the CRC
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRC16

public CRC16()
Method Detail

getValue

public int getValue()

reset

public void reset()
Reset the CRC


add

public void add(byte v)
Add the byte to the CRC

Parameters:
v - byte to add

add

public void add(byte[] b)
Add the byte[] to the CRC

Parameters:
b -

add

public void add(byte[] b,
                int start,
                int length)
Add the byte[] to the CRC

Parameters:
b - byte[]
start - start index within the array
length - number of bytes to add

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException


Copyright © 1998-2010 Retep Development Group. All Rights Reserved.