Interface Checksum

  • All Known Implementing Classes:
    Adler32, CRC32

    public interface Checksum
    Interface to compute a data checksum used by checked input/output streams. A data checksum can be updated by one byte or with a byte array. After each update the value of the current checksum can be returned by calling getValue. The complete checksum object can also be reset so it can be used again with new data.
    See Also:
    CheckedInputStream, CheckedOutputStream
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getValue()
      Returns the data checksum computed so far.
      void reset()
      Resets the data checksum as if no update was ever called.
      void update​(byte[] buf, int off, int len)
      Adds the byte array to the data checksum.
      void update​(int bval)
      Adds one byte to the data checksum.
    • Method Detail

      • getValue

        long getValue()
        Returns the data checksum computed so far.
      • reset

        void reset()
        Resets the data checksum as if no update was ever called.
      • update

        void update​(int bval)
        Adds one byte to the data checksum.
        Parameters:
        bval - the data value to add. The high byte of the int is ignored.
      • update

        void update​(byte[] buf,
                    int off,
                    int len)
        Adds the byte array to the data checksum.
        Parameters:
        buf - the buffer which contains the data
        off - the offset in the buffer where the data starts
        len - the length of the data