C# Class CmisSync.Lib.Streams.NonClosingHashStream

This stream can be used like a CryptoStream, but does not closes/finilizes the given HashAlgorithm on dispose. Also any other operation than READ/WRITE are directly passed to the given stream.
Inheritance: StreamWrapper
Datei anzeigen Open project: OpenDataSpace/CmisSync Class Usage Examples

Public Methods

Method Description
NonClosingHashStream ( Stream stream, HashAlgorithm hashAlg, CryptoStreamMode mode ) : System

Initializes a new instance of the CmisSync.Lib.Streams.NonClosingHashStream class.

Read ( byte buffer, int offset, int count ) : int

Passes the call to exact the same method of the given stream. If mode is set to Read, the given HashAlgorithm is transformed by passing the output of the read operation.

Write ( byte buffer, int offset, int count ) : void

Passes the call to exact the same method of the given stream. If mode is set to Write, the given HashAlgorithm is transformed by passing the input of the write operation.

Method Details

NonClosingHashStream() public method

Initializes a new instance of the CmisSync.Lib.Streams.NonClosingHashStream class.
public NonClosingHashStream ( Stream stream, HashAlgorithm hashAlg, CryptoStreamMode mode ) : System
stream Stream /// Wrapped stream. ///
hashAlg System.Security.Cryptography.HashAlgorithm /// Hash algorithm, which should be used for hash calculations. ///
mode CryptoStreamMode /// Setting the mode, when hashing should be executed. On Read will transform the hash while reading, or Write mode for transforming while writing. ///
return System

Read() public method

Passes the call to exact the same method of the given stream. If mode is set to Read, the given HashAlgorithm is transformed by passing the output of the read operation.
public Read ( byte buffer, int offset, int count ) : int
buffer byte /// Buffer. ///
offset int /// Offset. ///
count int /// Count. ///
return int

Write() public method

Passes the call to exact the same method of the given stream. If mode is set to Write, the given HashAlgorithm is transformed by passing the input of the write operation.
public Write ( byte buffer, int offset, int count ) : void
buffer byte /// Given Buffer. ///
offset int /// Given Offset. ///
count int /// Count of bytes. ///
return void