com.voxbiblia.id3j
Class CRC32Compensator

java.lang.Object
  extended by com.voxbiblia.id3j.CRC32Compensator

public class CRC32Compensator
extends Object

The CRC32Compensator provides functionality to generate compensating data bytes that can be put into a byte stream to yield any CRC-32 checksum. For more information please see http://resare.com/crc32


Constructor Summary
CRC32Compensator()
           
 
Method Summary
static byte[] compensate(int sourceChecksum, int targetChecksum)
          Returns 4 bytes of data that compensates the CRC32 checksum of some data to match targetChecksum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRC32Compensator

public CRC32Compensator()
Method Detail

compensate

public static byte[] compensate(int sourceChecksum,
                                int targetChecksum)
Returns 4 bytes of data that compensates the CRC32 checksum of some data to match targetChecksum. In other words if a byte string S has the CRC32 checksum sourceChecksum and it is concatenated with the bytes returned by this method the resulting byte string will have a CRC32 checksum equal to targetChecksum.

Parameters:
sourceChecksum - the current checksum
targetChecksum - the desired checksum
Returns:
four bytes of data