com.plumtree.openfoundation.util
Class XPCRC

java.lang.Object
  extended bycom.plumtree.openfoundation.util.XPCRC

public class XPCRC
extends java.lang.Object

Implements equivalent CRC algorithms as found in C++ versions in IPTUtility_CRC.

Author:
MichaelY

Nested Class Summary
static class XPCRC.XPCRCValue
          Simple CRC data class representing a 64-bit CRC value.
 
Constructor Summary
XPCRC()
           
 
Method Summary
static int GenerateCRC32(java.lang.String inputString)
          Calculates the 32-bit CRC from a String.
static XPCRC.XPCRCValue GenerateCRC64(java.lang.String inputString)
          Calculates the 64-bit CRC from a String.
static int GenerateFileCRC32(java.lang.String filePath)
          Calculates the 32-bit CRC from a file-based binary stream.
static XPCRC.XPCRCValue GenerateFileCRC64(java.lang.String filePath)
          Calculates the 64-bit CRC from a file-based binary stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPCRC

public XPCRC()
Method Detail

GenerateFileCRC64

public static XPCRC.XPCRCValue GenerateFileCRC64(java.lang.String filePath)
Calculates the 64-bit CRC from a file-based binary stream. See GenerateCRC64 for more information.

Parameters:
filePath - a binary file stream.
Returns:
64-bit CRC value

GenerateFileCRC32

public static int GenerateFileCRC32(java.lang.String filePath)
Calculates the 32-bit CRC from a file-based binary stream.

Parameters:
filePath - a binary file stream.
Returns:
32-bit CRC value.

GenerateCRC64

public static XPCRC.XPCRCValue GenerateCRC64(java.lang.String inputString)
Calculates the 64-bit CRC from a String. This is simply two CRC32 values combined into a 64-bit value. The high 32-bit CRC is the CRC32 of the odd characters in the String. The low 32-bit CRC is the CRC32 of the even characters.

Parameters:
inputString - String value for which CRC is generated.
Returns:
64-bit CRC value

GenerateCRC32

public static int GenerateCRC32(java.lang.String inputString)
Calculates the 32-bit CRC from a String.

Parameters:
inputString - String input to be converted to CRC.
Returns:
32-bit CRC value


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.