Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jempeg.empeg.protocol
Class CRC16  view CRC16 download CRC16.java

java.lang.Object
  extended byorg.jempeg.empeg.protocol.CRC16

public class CRC16
extends java.lang.Object

The CRC implementation that was "borrowed" from our friends at Empeg.

Version:
$Revision: 1.6 $

Field Summary
static int[] crc16tab
           
private  int myValue
           
 
Constructor Summary
CRC16()
          Creates a new CRC16 and resets the value
 
Method Summary
 EmpegUINT16 getValue()
          Returns the current CRC value
 void reset()
          Resets the CRC value
 void update(byte[] _buffer)
          Updates the CRC with an array of unsigned 8-bit values (cast as bytes)
 void update(byte[] _buffer, int _offset, int _length)
          Updates the CRC with an array of unsigned 8-bit values (cast as bytes)
 void update(int _value)
          Updates the value with the unsigned 8-bit value
 void update(int[] _buffer)
          Updates the CRC with an array of unsigned 8-bit values (cast as ints)
 void update(short[] _buffer)
          Updates the CRC with an array of unsigned 8-bit values (cast as shorts)
 void updateSigned16(int _value)
          Updates the CRC with a signed 16-bit value
 void updateSigned32(int _value)
          Updates the CRC with a signed 32-bit value
 void updateSigned8(int _value)
          Updates the CRC with a signed 8-bit value
 void updateUnsigned16(int _value)
          Updates the CRC with an unsigned 16-bit value
 void updateUnsigned32(long _value)
          Updates the CRC with an unsigned 32-bit value
 void updateUnsigned8(int _value)
          Updates the CRC with an unsigned 8-bit value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crc16tab

public static final int[] crc16tab

myValue

private int myValue
Constructor Detail

CRC16

public CRC16()
Creates a new CRC16 and resets the value

Method Detail

update

public final void update(byte[] _buffer)
Updates the CRC with an array of unsigned 8-bit values (cast as bytes)


update

public final void update(byte[] _buffer,
                         int _offset,
                         int _length)
Updates the CRC with an array of unsigned 8-bit values (cast as bytes)


update

public final void update(short[] _buffer)
Updates the CRC with an array of unsigned 8-bit values (cast as shorts)


update

public final void update(int[] _buffer)
Updates the CRC with an array of unsigned 8-bit values (cast as ints)


updateSigned8

public final void updateSigned8(int _value)
Updates the CRC with a signed 8-bit value


updateUnsigned8

public final void updateUnsigned8(int _value)
Updates the CRC with an unsigned 8-bit value


updateSigned16

public final void updateSigned16(int _value)
Updates the CRC with a signed 16-bit value


updateUnsigned16

public final void updateUnsigned16(int _value)
Updates the CRC with an unsigned 16-bit value


updateSigned32

public final void updateSigned32(int _value)
Updates the CRC with a signed 32-bit value


updateUnsigned32

public final void updateUnsigned32(long _value)
Updates the CRC with an unsigned 32-bit value


update

public final void update(int _value)
Updates the value with the unsigned 8-bit value


getValue

public final EmpegUINT16 getValue()
Returns the current CRC value


reset

public final void reset()
Resets the CRC value