Class CrcCalculatorStream
- Namespace
- ThirdParty.Ionic.Zlib
- Assembly
- AWSSDK.Core.dll
A Stream that calculates a CRC32 (a checksum) on all bytes read, or on all bytes written.
public class CrcCalculatorStream : Stream, IDisposable, IAsyncDisposable
- Inheritance
-
CrcCalculatorStream
- Implements
- Inherited Members
Remarks
This class can be used to verify the CRC of a ZipEntry when reading from a stream, or to calculate a CRC when writing to a stream. The stream should be used to either read, or write, but not both. If you intermix reads and writes, the results are not defined.
This class is intended primarily for use internally by the DotNetZip library.
Constructors
CrcCalculatorStream(Stream)
The constructor.
public CrcCalculatorStream(Stream stream)
Parameters
stream
StreamThe underlying stream
CrcCalculatorStream(Stream, long)
The constructor.
public CrcCalculatorStream(Stream stream, long length)
Parameters
Properties
CanRead
Indicates whether the stream supports reading.
public override bool CanRead { get; }
Property Value
CanSeek
Indicates whether the stream supports seeking.
public override bool CanSeek { get; }
Property Value
CanWrite
Indicates whether the stream supports writing.
public override bool CanWrite { get; }
Property Value
Crc32
Provides the current CRC for all blocks slurped in.
public int Crc32 { get; }
Property Value
Length
Not implemented.
public override long Length { get; }
Property Value
Position
Not implemented.
public override long Position { get; set; }
Property Value
TotalBytesSlurped
Gets the total number of bytes run through the CRC32 calculator.
public long TotalBytesSlurped { get; }
Property Value
Remarks
This is either the total number of bytes read, or the total number of bytes written, depending on the direction of this stream.
Methods
Flush()
Flush the stream.
public override void Flush()
Read(byte[], int, int)
Read from the stream
public override int Read(byte[] buffer, int offset, int count)
Parameters
buffer
byte[]the buffer to read
offset
intthe offset at which to start
count
intthe number of bytes to read
Returns
- int
the number of bytes actually read
Seek(long, SeekOrigin)
Not implemented.
public override long Seek(long offset, SeekOrigin origin)
Parameters
offset
longN/A
origin
SeekOriginN/A
Returns
- long
N/A
SetLength(long)
Not implemented.
public override void SetLength(long value)
Parameters
value
longN/A
Write(byte[], int, int)
Write to the stream.
public override void Write(byte[] buffer, int offset, int count)