CrcStream Class
Wraps a source stream and calcaluates a CRC over all bytes that are read or written.
Methods
Section titled “Methods”| Method | Description |
|---|---|
| Close() | Closes the underlying stream. |
| Flush() | Flushes the source stream. |
| Read(buffer, offset, count) | Reads a sequence of bytes from the source stream and advances the position within the stream by the number of bytes read. |
| Seek(offset, origin) | Sets the position within the source stream. |
| SetLength(value) | Sets the length of the source stream. |
| Write(buffer, offset, count) | Writes a sequence of bytes to the source stream and advances the current position within this stream by the number of bytes written. |
Properties
Section titled “Properties”| Property | Description |
|---|---|
| CanRead | Gets a value indicating whether the source stream supports reading. |
| CanSeek | Gets a value indicating whether the source stream supports seeking. |
| CanWrite | Gets a value indicating whether the source stream supports writing. |
| Crc | Gets the current CRC over all bytes that have been read or written since this instance was created. |
| Length | Gets the length of the source stream. |
| Position | Gets or sets the position of the source stream. |
| Source | Gets the underlying stream that this stream reads from or writes to. |
Remarks
Section titled “Remarks”The CRC algorithm matches that used in the standard ZIP file format.
WixToolset.Dtf.Compression.Zip.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8
Close() Method
Section titled “Close() Method”Closes the underlying stream.
Declaration
Section titled “Declaration”public void Close()Flush() Method
Section titled “Flush() Method”Flushes the source stream.
Declaration
Section titled “Declaration”public void Flush()Read(buffer, offset, count) Method
Section titled “Read(buffer, offset, count) Method”Reads a sequence of bytes from the source stream and advances the position within the stream by the number of bytes read.
Declaration
Section titled “Declaration”public int Read( System.Byte[] buffer, int offset, int count)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| buffer | System.Byte[] | An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source. |
| offset | int | The zero-based byte offset in buffer at which to begin storing the data read from the current stream. |
| count | int | The maximum number of bytes to be read from the current stream. |
Return value
Section titled “Return value”int The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
Seek(offset, origin) Method
Section titled “Seek(offset, origin) Method”Sets the position within the source stream.
Declaration
Section titled “Declaration”public System.Int64 Seek( System.Int64 offset, System.IO.SeekOrigin origin)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| offset | System.Int64 | A byte offset relative to the origin parameter. |
| origin | System.IO.SeekOrigin | A value of type SeekOrigin indicating the reference point used to obtain the new position. |
Return value
Section titled “Return value”System.Int64 The new position within the source stream.
Remarks
Section titled “Remarks”Note the CRC is only calculated over bytes that are actually read or written, so any bytes skipped by seeking will not contribute to the CRC.
SetLength(value) Method
Section titled “SetLength(value) Method”Sets the length of the source stream.
Declaration
Section titled “Declaration”public void SetLength( System.Int64 value)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| value | System.Int64 | The desired length of the stream in bytes. |
Write(buffer, offset, count) Method
Section titled “Write(buffer, offset, count) Method”Writes a sequence of bytes to the source stream and advances the current position within this stream by the number of bytes written.
Declaration
Section titled “Declaration”public void Write( System.Byte[] buffer, int offset, int count)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| buffer | System.Byte[] | An array of bytes. This method copies count bytes from buffer to the current stream. |
| offset | int | The zero-based byte offset in buffer at which to begin copying bytes to the current stream. |
| count | int | The number of bytes to be written to the current stream. |
CanRead Property
Section titled “CanRead Property”Gets a value indicating whether the source stream supports reading.
Declaration
Section titled “Declaration”public bool CanRead { get; set; }CanSeek Property
Section titled “CanSeek Property”Gets a value indicating whether the source stream supports seeking.
Declaration
Section titled “Declaration”public bool CanSeek { get; set; }CanWrite Property
Section titled “CanWrite Property”Gets a value indicating whether the source stream supports writing.
Declaration
Section titled “Declaration”public bool CanWrite { get; set; }Crc Property
Section titled “Crc Property”Gets the current CRC over all bytes that have been read or written since this instance was created.
Declaration
Section titled “Declaration”public System.UInt32 Crc { get; set; }Length Property
Section titled “Length Property”Gets the length of the source stream.
Declaration
Section titled “Declaration”public System.Int64 Length { get; set; }Position Property
Section titled “Position Property”Gets or sets the position of the source stream.
Declaration
Section titled “Declaration”public System.Int64 Position { get; set; }Source Property
Section titled “Source Property”Gets the underlying stream that this stream reads from or writes to.
Declaration
Section titled “Declaration”public System.IO.Stream Source { get; set; }