Class RpcCRC32Checksum

  • All Implemented Interfaces:
    java.util.zip.Checksum

    public class RpcCRC32Checksum
    extends java.util.zip.CRC32
    Provides a wrapper to the basic Java CRC32 to allow us to use the JZlib pure Java implementation of the CRC32 checksum from RFC1952.

    This avoids the basic Java CRC32's JNI overhead for certain uses of checksumming where many small pieces of data are checksummed in succession.

    • Constructor Summary

      Constructors 
      Constructor Description
      RpcCRC32Checksum()
      Creates a new RpcCRC32Checksum object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getValue()
      Returns CRC-32 value.
      void reset()
      Resets Rpc CRC-32 to initial value.
      void update​(byte[] b)
      Updates the Rpc CRC-32 checksum with the specified array of bytes.
      void update​(byte[] b, int off, int len)
      Updates the Rpc CRC-32 checksum with the specified array of bytes.
      void update​(int b)
      Updates the Rpc CRC-32 checksum with the specified byte (the low eight bits of the argument b).
      • Methods inherited from class java.util.zip.CRC32

        update
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RpcCRC32Checksum

        public RpcCRC32Checksum()
        Creates a new RpcCRC32Checksum object.
    • Method Detail

      • update

        public void update​(int b)
        Updates the Rpc CRC-32 checksum with the specified byte (the low eight bits of the argument b).
        Specified by:
        update in interface java.util.zip.Checksum
        Overrides:
        update in class java.util.zip.CRC32
        Parameters:
        b - the byte to update the checksum with
      • update

        public void update​(byte[] b,
                           int off,
                           int len)
        Updates the Rpc CRC-32 checksum with the specified array of bytes.
        Specified by:
        update in interface java.util.zip.Checksum
        Overrides:
        update in class java.util.zip.CRC32
      • update

        public void update​(byte[] b)
        Updates the Rpc CRC-32 checksum with the specified array of bytes.
        Parameters:
        b - the array of bytes to update the checksum with
      • reset

        public void reset()
        Resets Rpc CRC-32 to initial value.
        Specified by:
        reset in interface java.util.zip.Checksum
        Overrides:
        reset in class java.util.zip.CRC32
      • getValue

        public long getValue()
        Returns CRC-32 value.
        Specified by:
        getValue in interface java.util.zip.Checksum
        Overrides:
        getValue in class java.util.zip.CRC32