C# Класс Crisis.Ionic.Crc.CrcCalculatorStream

A Stream that calculates a CRC32 (a checksum) on all bytes read, or on all bytes written.

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.

Наследование: System.IO.Stream, System.IDisposable
Показать файл Открыть проект

Открытые методы

Метод Описание
Close ( ) : void

Closes the stream.

CrcCalculatorStream ( System stream ) : System

The default constructor.

Instances returned from this constructor will leave the underlying stream open upon Close(). The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

CrcCalculatorStream ( System stream, System.Int64 length ) : System

A constructor allowing the specification of the length of the stream to read.

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

Instances returned from this constructor will leave the underlying stream open upon Close().

CrcCalculatorStream ( System stream, System.Int64 length, bool leaveOpen ) : System

A constructor allowing the specification of the length of the stream to read, as well as whether to keep the underlying stream open upon Close().

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

CrcCalculatorStream ( System stream, System.Int64 length, bool leaveOpen, CRC32 crc32 ) : System

A constructor allowing the specification of the length of the stream to read, as well as whether to keep the underlying stream open upon Close(), and the CRC32 instance to use.

The stream uses the specified CRC32 instance, which allows the application to specify how the CRC gets calculated.

CrcCalculatorStream ( System stream, bool leaveOpen ) : System

The constructor allows the caller to specify how to handle the underlying stream at close.

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

Flush ( ) : void

Flush the stream.

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

Read from the stream

Seek ( long offset, System origin ) : long

Seeking is not supported on this stream. This method always throws NotSupportedException

SetLength ( long value ) : void

This method always throws NotSupportedException

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

Write to the stream.

Приватные методы

Метод Описание
CrcCalculatorStream ( bool leaveOpen, System.Int64 length, System stream, CRC32 crc32 ) : System
IDisposable ( ) : void

Описание методов

Close() публичный Метод

Closes the stream.
public Close ( ) : void
Результат void

CrcCalculatorStream() публичный Метод

The default constructor.

Instances returned from this constructor will leave the underlying stream open upon Close(). The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

public CrcCalculatorStream ( System stream ) : System
stream System The underlying stream
Результат System

CrcCalculatorStream() публичный Метод

A constructor allowing the specification of the length of the stream to read.

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

Instances returned from this constructor will leave the underlying stream open upon Close().

public CrcCalculatorStream ( System stream, System.Int64 length ) : System
stream System The underlying stream
length System.Int64 The length of the stream to slurp
Результат System

CrcCalculatorStream() публичный Метод

A constructor allowing the specification of the length of the stream to read, as well as whether to keep the underlying stream open upon Close().

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

public CrcCalculatorStream ( System stream, System.Int64 length, bool leaveOpen ) : System
stream System The underlying stream
length System.Int64 The length of the stream to slurp
leaveOpen bool true to leave the underlying stream /// open upon close of the CrcCalculatorStream; false otherwise.
Результат System

CrcCalculatorStream() публичный Метод

A constructor allowing the specification of the length of the stream to read, as well as whether to keep the underlying stream open upon Close(), and the CRC32 instance to use.

The stream uses the specified CRC32 instance, which allows the application to specify how the CRC gets calculated.

public CrcCalculatorStream ( System stream, System.Int64 length, bool leaveOpen, CRC32 crc32 ) : System
stream System The underlying stream
length System.Int64 The length of the stream to slurp
leaveOpen bool true to leave the underlying stream /// open upon close of the CrcCalculatorStream; false otherwise.
crc32 CRC32 the CRC32 instance to use to calculate the CRC32
Результат System

CrcCalculatorStream() публичный Метод

The constructor allows the caller to specify how to handle the underlying stream at close.

The stream uses the default CRC32 algorithm, which implies a polynomial of 0xEDB88320.

public CrcCalculatorStream ( System stream, bool leaveOpen ) : System
stream System The underlying stream
leaveOpen bool true to leave the underlying stream /// open upon close of the CrcCalculatorStream; false otherwise.
Результат System

Flush() публичный Метод

Flush the stream.
public Flush ( ) : void
Результат void

Read() публичный Метод

Read from the stream
public Read ( byte buffer, int offset, int count ) : int
buffer byte the buffer to read
offset int the offset at which to start
count int the number of bytes to read
Результат int

Seek() публичный Метод

Seeking is not supported on this stream. This method always throws NotSupportedException
public Seek ( long offset, System origin ) : long
offset long N/A
origin System N/A
Результат long

SetLength() публичный Метод

This method always throws NotSupportedException
public SetLength ( long value ) : void
value long N/A
Результат void

Write() публичный Метод

Write to the stream.
public Write ( byte buffer, int offset, int count ) : void
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
Результат void