Interface SdkChecksum

All Superinterfaces:
Checksum
All Known Implementing Classes:
Crc32CChecksum, Crc32Checksum, Md5Checksum, Sha1Checksum, Sha256Checksum

public interface SdkChecksum extends Checksum
Extension of Checksum to support checksums and checksum validations used by the SDK that are not provided by the JDK.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the Checksum based on the required Algorithm.
    byte[]
    Returns the computed checksum in a byte array rather than the long provided by Checksum.getValue().
    void
    mark(int readLimit)
    Allows marking a checksum for checksums that support the ability to mark and reset.
    default void
    update(byte[] b)
    Updates the current checksum with the specified array of bytes.
    default void
    Updates the current checksum with the bytes from the specified buffer.

    Methods inherited from interface java.util.zip.Checksum

    getValue, reset, update, update
  • Method Details

    • getChecksumBytes

      byte[] getChecksumBytes()
      Returns the computed checksum in a byte array rather than the long provided by Checksum.getValue().
      Returns:
      byte[] containing the checksum
    • mark

      void mark(int readLimit)
      Allows marking a checksum for checksums that support the ability to mark and reset.
      Parameters:
      readLimit - the maximum limit of bytes that can be read before the mark position becomes invalid.
    • forAlgorithm

      static SdkChecksum forAlgorithm(Algorithm algorithm)
      Gets the Checksum based on the required Algorithm. Instances for CRC32C, CRC32 Algorithm will be added from CRT Java library once they are available in release.
      Parameters:
      algorithm - Algorithm for calculating the checksum
      Returns:
      Optional Checksum instances.
    • update

      default void update(byte[] b)
      Updates the current checksum with the specified array of bytes.
      Parameters:
      b - the array of bytes to update the checksum with
      Throws:
      NullPointerException - if b is null
    • update

      default void update(ByteBuffer buffer)
      Updates the current checksum with the bytes from the specified buffer. The checksum is updated with the remaining bytes in the buffer, starting at the buffer's position. Upon return, the buffer's position will be updated to its limit; its limit will not have been changed.
      Parameters:
      buffer - the ByteBuffer to update the checksum with
      Throws:
      NullPointerException - if buffer is null