net.rim.device.api.util
Class CRC32

java.lang.Object
  |
  +--net.rim.device.api.util.CRC32

public final class CRC32
extends Object

Computes the 32-bit CRC (checksum) for a data stream.

Based on FCS-32 specified in RFC 1662 (STD 51).

Note: The byte ordering of the resulting checksum value depends on the protocol in which the CRC is used. The ordering used in a specified protocol might be different from the ordering used in this implementation. The output of this implementation can be reversed when used with such a protocol.


Field Summary
static int INITIAL_VALUE
          Initial checksum value used before updates.
 
Method Summary
static int update(int crc, byte[] b)
          Updates the checksum with the specified array of bytes.
static int update(int crc, byte[] b, int offset, int length)
          Updates the checksum with a section of provided array of bytes.
static int update(int crc, int b)
          Updates the checksum with the specified byte.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_VALUE

public static final int INITIAL_VALUE
Initial checksum value used before updates.
Method Detail

update

public static int update(int crc,
                         byte[] b)
Updates the checksum with the specified array of bytes.

Parameters:
crc - The checksum to update.
b - The byte array with which to update the checksum.
Returns:
Resulting checksum value.

update

public static int update(int crc,
                         byte[] b,
                         int offset,
                         int length)
Updates the checksum with a section of provided array of bytes.

Parameters:
crc - The checksum to update.
b - A byte array containing the section with which to update the checksum.
off - The first element in the byte array used to update the checksum.
len - The number of bytes in the section used to update the checksum.
Returns:
Resulting checksum value.

update

public static int update(int crc,
                         int b)
Updates the checksum with the specified byte.

Parameters:
crc - The checksum to update.
b - The byte with which to update the checksum.
Returns:
Resulting checksum value.



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.