Table of Contents

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 Stream

The underlying stream

CrcCalculatorStream(Stream, long)

The constructor.

public CrcCalculatorStream(Stream stream, long length)

Parameters

stream Stream

The underlying stream

length long

The length of the stream to slurp

Properties

CanRead

Indicates whether the stream supports reading.

public override bool CanRead { get; }

Property Value

bool

CanSeek

Indicates whether the stream supports seeking.

public override bool CanSeek { get; }

Property Value

bool

CanWrite

Indicates whether the stream supports writing.

public override bool CanWrite { get; }

Property Value

bool

Crc32

Provides the current CRC for all blocks slurped in.

public int Crc32 { get; }

Property Value

int

Length

Not implemented.

public override long Length { get; }

Property Value

long

Position

Not implemented.

public override long Position { get; set; }

Property Value

long

TotalBytesSlurped

Gets the total number of bytes run through the CRC32 calculator.

public long TotalBytesSlurped { get; }

Property Value

long

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 int

the offset at which to start

count int

the 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 long

N/A

origin SeekOrigin

N/A

Returns

long

N/A

SetLength(long)

Not implemented.

public override void SetLength(long value)

Parameters

value long

N/A

Write(byte[], int, int)

Write to the stream.

public override void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]

the buffer from which to write

offset int

the offset at which to start writing

count int

the number of bytes to write