C# Class Microsoft.Deployment.Compression.Zip.CrcStream

Inheritance: Stream
显示文件 Open project: chakrit/rambase Class Usage Examples

Private Properties

Property Type Description
MakeCrcTable uint[]
Reflect uint
UpdateCrc void

Public Methods

Method Description
Close ( ) : void

Closes the underlying stream.

CrcStream ( Stream source ) : System

Creates a new CrcStream instance from a source stream.

Flush ( ) : void

Flushes the source stream.

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

Reads a sequence of bytes from the source stream and advances the position within the stream by the number of bytes read.

Seek ( long offset, SeekOrigin origin ) : long

Sets the position within the source stream.

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 ( long value ) : void

Sets the length of the source stream.

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

Writes a sequence of bytes to the source stream and advances the current position within this stream by the number of bytes written.

Private Methods

Method Description
MakeCrcTable ( ) : uint[]

Computes a table that speeds up calculation of the CRC.

Reflect ( uint value, int bits ) : uint

Reflects the ordering of certain number of bits. For exmample when reflecting one byte, bit one is swapped with bit eight, bit two with bit seven, etc.

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

Updates the CRC with a range of bytes that were read or written.

Method Details

Close() public method

Closes the underlying stream.
public Close ( ) : void
return void

CrcStream() public method

Creates a new CrcStream instance from a source stream.
public CrcStream ( Stream source ) : System
source Stream Underlying stream where bytes will be read from or written to.
return System

Flush() public method

Flushes the source stream.
public Flush ( ) : void
return void

Read() public method

Reads a sequence of bytes from the source stream and advances the position within the stream by the number of bytes read.
public Read ( byte buffer, int offset, int count ) : int
buffer 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 int

Seek() public method

Sets the position within the source stream.
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.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the origin parameter.
origin SeekOrigin A value of type SeekOrigin indicating /// the reference point used to obtain the new position.
return long

SetLength() public method

Sets the length of the source stream.
public SetLength ( long value ) : void
value long The desired length of the /// stream in bytes.
return void

Write() public method

Writes a sequence of bytes to the source stream and advances the current position within this stream by the number of bytes written.
public Write ( byte buffer, int offset, int count ) : void
buffer 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.
return void