Checksum
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
Adler32 |
A class that can be used to compute the Adler-32 checksum of a data
stream. |
CRC32 |
A class that can be used to compute the CRC-32 of a data stream. |
|
An interface representing a data checksum.
Public Method Summary
abstract
long
|
getValue()
Returns the current checksum value.
|
abstract
void
|
reset()
Resets the checksum to its initial value.
|
abstract
void
|
update(byte[] b, int off, int len)
Updates the current checksum with the specified array of bytes.
|
abstract
void
|
update(int b)
Updates the current checksum with the specified byte.
|
Public Methods
public
abstract
long
getValue
()
Returns the current checksum value.
Returns
- the current checksum value
public
abstract
void
reset
()
Resets the checksum to its initial value.
public
abstract
void
update
(byte[] b, int off, int len)
Updates the current checksum with the specified array of bytes.
Parameters
b |
the byte array to update the checksum with |
off |
the start offset of the data |
len |
the number of bytes to use for the update
|
public
abstract
void
update
(int b)
Updates the current checksum with the specified byte.
Parameters
b |
the byte to update the checksum with
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eChecksum\u003c/code\u003e is an interface in Java that represents a data checksum, used to verify data integrity.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to update the checksum with bytes or byte arrays, reset the checksum, and retrieve the current checksum value.\u003c/p\u003e\n"],["\u003cp\u003eKnown implementations include \u003ccode\u003eAdler32\u003c/code\u003e and \u003ccode\u003eCRC32\u003c/code\u003e, which are used to compute Adler-32 and CRC-32 checksums, respectively.\u003c/p\u003e\n"]]],["The `Checksum` interface defines methods for managing data checksums. It includes `getValue()` to retrieve the current checksum value, `reset()` to revert to the initial state, and `update()` for incorporating data into the checksum. There are two `update` methods, one for handling a byte array with specified offset and length, and another one to handle a single byte. The `Adler32` and `CRC32` classes are indirect subclasses, and compute different type of data stream checksum.\n"],null,["public interface **Checksum** \n\n|---|---|---|\n| Known Indirect Subclasses [Adler32](../../../../reference/java/util/zip/Adler32.html), [CRC32](../../../../reference/java/util/zip/CRC32.html) |-------------------------------------------------------------|-----------------------------------------------------------------------------| | [Adler32](../../../../reference/java/util/zip/Adler32.html) | A class that can be used to compute the Adler-32 checksum of a data stream. | | [CRC32](../../../../reference/java/util/zip/CRC32.html) | A class that can be used to compute the CRC-32 of a data stream. | |||\n\nAn interface representing a data checksum. \n\nPublic Method Summary\n\n|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract long | [getValue](../../../../reference/java/util/zip/Checksum.html#getValue())() Returns the current checksum value. |\n| abstract void | [reset](../../../../reference/java/util/zip/Checksum.html#reset())() Resets the checksum to its initial value. |\n| abstract void | [update](../../../../reference/java/util/zip/Checksum.html#update(byte[],%20int,%20int))(byte\\[\\] b, int off, int len) Updates the current checksum with the specified array of bytes. |\n| abstract void | [update](../../../../reference/java/util/zip/Checksum.html#update(int))(int b) Updates the current checksum with the specified byte. |\n\nPublic Methods \n\npublic abstract long\n**getValue**\n() \nReturns the current checksum value. \n\nReturns\n\n- the current checksum value \n\npublic abstract void\n**reset**\n() \nResets the checksum to its initial value. \n\npublic abstract void\n**update**\n(byte\\[\\] b, int off, int len) \nUpdates the current checksum with the specified array of bytes. \n\nParameters\n\n| b | the byte array to update the checksum with |\n| off | the start offset of the data |\n| len | the number of bytes to use for the update |\n|-----|--------------------------------------------|\n\npublic abstract void\n**update**\n(int b) \nUpdates the current checksum with the specified byte. \n\nParameters\n\n| b | the byte to update the checksum with |\n|---|--------------------------------------|"]]