org.xiph.speex
Class OggCrc

java.lang.Object
  extended byorg.xiph.speex.OggCrc

public class OggCrc
extends java.lang.Object

Calculates the CRC checksum for Ogg packets.

Ogg uses the same generator polynomial as ethernet, although with an unreflected alg and an init/final of 0, not 0xffffffff.

Version:
$Revision: 1.5 $
Author:
Jim Lawrence, helloNetwork.com, Marc Gimpel, Wimba S.A. (marc@wimba.com)

Field Summary
private static int[] crc_lookup
          CRC checksum lookup table
 
Constructor Summary
OggCrc()
           
 
Method Summary
static int checksum(int crc, byte[] data, int offset, int length)
          Calculates the checksum on the given data, from the give offset and for the given length, using the given initial value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crc_lookup

private static int[] crc_lookup
CRC checksum lookup table

Constructor Detail

OggCrc

public OggCrc()
Method Detail

checksum

public static int checksum(int crc,
                           byte[] data,
                           int offset,
                           int length)
Calculates the checksum on the given data, from the give offset and for the given length, using the given initial value. This allows on to calculate the checksum iteratively, by reinjecting the last returned value as the initial value when the function is called for the next data chunk. The initial value should be 0 for the first iteration.

Parameters:
crc - - the initial value
data - - the data
offset - - the offset at which to start calculating the checksum.
length - - the length of data over which to calculate the checksum.
Returns:
the checksum.


Copyright © 1999-2004 Wimba S.A. All Rights Reserved.