Code example for CRC32

Methods: getValue, update

0
        CommitLog.instance.add(rm);
    } 
 
    protected void testRecoveryWithBadSizeArgument(int size, int dataSize) throws Exception
    { 
        Checksum checksum = new CRC32();
        checksum.update(size);
        testRecoveryWithBadSizeArgument(size, dataSize, checksum.getValue());
    } 
 
    protected void testRecoveryWithBadSizeArgument(int size, int dataSize, long checksum) throws Exception
    { 
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DataOutputStream dout = new DataOutputStream(out);
        dout.writeInt(size);
        dout.writeLong(checksum);
        dout.write(new byte[dataSize]);
        dout.close();
        testRecovery(out.toByteArray());
    }