| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- namespace ICSharpCode.SharpZipLib.Checksum
- {
- /// <summary>
- /// 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
- /// <code>getValue</code>. The complete checksum object can also be reset
- /// so it can be used again with new data.
- /// </summary>
- public interface IChecksum
- {
- /// <summary>
- /// Resets the data checksum as if no update was ever called.
- /// </summary>
- void Reset();
- /// <summary>
- /// Returns the data checksum computed so far.
- /// </summary>
- long Value
- {
- get;
- }
- /// <summary>
- /// Adds one byte to the data checksum.
- /// </summary>
- /// <param name = "bval">
- /// the data value to add. The high byte of the int is ignored.
- /// </param>
- void Update(int bval);
- /// <summary>
- /// Updates the data checksum with the bytes taken from the array.
- /// </summary>
- /// <param name="buffer">
- /// buffer an array of bytes
- /// </param>
- void Update(byte[] buffer);
- /// <summary>
- /// Adds the byte array to the data checksum.
- /// </summary>
- /// <param name = "segment">
- /// The chunk of data to add
- /// </param>
- void Update(ArraySegment<byte> segment);
- }
- }
|