org.jruby.util
Class CRC32Ext

java.lang.Object
  extended by org.jruby.util.CRC32Ext
All Implemented Interfaces:
java.util.zip.Checksum

public class CRC32Ext
extends java.lang.Object
implements java.util.zip.Checksum

This class is a wrapper around Adler32 which provides the capability to update the running total. This functionality is provided by quite risky reflection and should be fixed in a better way later on.


Constructor Summary
CRC32Ext()
          Creates the basic object with default initial adler.
CRC32Ext(int crc)
          Creates the basic object with the adler provided.
 
Method Summary
 long getValue()
           
 void reset()
           
 void setAdler(int crc)
          Sets the adler running total to the specified value.
 void update(byte[] b)
           
 void update(byte[] b, int off, int len)
           
 void update(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRC32Ext

public CRC32Ext()
Creates the basic object with default initial adler.


CRC32Ext

public CRC32Ext(int crc)
Creates the basic object with the adler provided.

Parameters:
adler - the number to use as starting point for the CRC-32 algorithm
Method Detail

setAdler

public void setAdler(int crc)
Sets the adler running total to the specified value.

Parameters:
adler - the number to use as current value for the CRC-32 algorithm

update

public void update(int b)
Specified by:
update in interface java.util.zip.Checksum
See Also:
Checksum.update(int)

update

public void update(byte[] b,
                   int off,
                   int len)
Specified by:
update in interface java.util.zip.Checksum
See Also:
Checksum.update(int)

update

public void update(byte[] b)
See Also:
Checksum.update(int)

reset

public void reset()
Specified by:
reset in interface java.util.zip.Checksum
See Also:
Checksum.reset()

getValue

public long getValue()
Specified by:
getValue in interface java.util.zip.Checksum
See Also:
Checksum.getValue()


Copyright © 2002-2009 JRuby Team. All Rights Reserved.