ElectroServer 5 Client: C#
Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream Class Reference

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

Inheritance diagram for Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream:

Public Member Functions

 CrcCalculatorStream (System.IO.Stream stream)
 The default constructor. More...
 
 CrcCalculatorStream (System.IO.Stream stream, bool leaveOpen)
 The constructor allows the caller to specify how to handle the underlying stream at close. More...
 
 CrcCalculatorStream (System.IO.Stream stream, Int64 length)
 A constructor allowing the specification of the length of the stream to read. More...
 
 CrcCalculatorStream (System.IO.Stream stream, Int64 length, bool leaveOpen)
 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(). More...
 
override int Read (byte[] buffer, int offset, int count)
 Read from the stream More...
 
override void Write (byte[] buffer, int offset, int count)
 Write to the stream. More...
 
override void Flush ()
 Flush the stream. More...
 
override long Seek (long offset, System.IO.SeekOrigin origin)
 Not implemented. More...
 
override void SetLength (long value)
 Not implemented. More...
 
override void Close ()
 Closes the stream. More...
 

Properties

Int64 TotalBytesSlurped [get]
 Gets the total number of bytes run through the CRC32 calculator. More...
 
Int32 Crc [get]
 Provides the current CRC for all blocks slurped in. More...
 
bool LeaveOpen [get, set]
 Indicates whether the underlying stream will be left open when the CrcCalculatorStream is Closed. More...
 
override bool CanRead [get]
 Indicates whether the stream supports reading. More...
 
override bool CanSeek [get]
 Indicates whether the stream supports seeking. More...
 
override bool CanWrite [get]
 Indicates whether the stream supports writing. More...
 
override long Length [get]
 Not implemented. More...
 
override long Position [get, set]
 Not implemented. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CrcCalculatorStream ( System.IO.Stream  stream)

The default constructor.

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

Parameters
streamThe underlying stream
Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CrcCalculatorStream ( System.IO.Stream  stream,
bool  leaveOpen 
)

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

Parameters
streamThe underlying stream
leaveOpentrue to leave the underlying stream open upon close of the CrcCalculatorStream.; false otherwise.
Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CrcCalculatorStream ( System.IO.Stream  stream,
Int64  length 
)

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

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

Parameters
streamThe underlying stream
lengthThe length of the stream to slurp
Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CrcCalculatorStream ( System.IO.Stream  stream,
Int64  length,
bool  leaveOpen 
)

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().

Parameters
streamThe underlying stream
lengthThe length of the stream to slurp
leaveOpentrue to leave the underlying stream open upon close of the CrcCalculatorStream.; false otherwise.

Member Function Documentation

override void Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Close ( )

Closes the stream.

override void Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Flush ( )

Flush the stream.

override int Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Read ( byte[]  buffer,
int  offset,
int  count 
)

Read from the stream

Parameters
bufferthe buffer to read
offsetthe offset at which to start
countthe number of bytes to read
Returns
the number of bytes actually read
override long Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Seek ( long  offset,
System.IO.SeekOrigin  origin 
)

Not implemented.

Parameters
offsetN/A
originN/A
Returns
N/A
override void Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.SetLength ( long  value)

Not implemented.

Parameters
valueN/A
override void Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Write ( byte[]  buffer,
int  offset,
int  count 
)

Write to the stream.

Parameters
bufferthe buffer from which to write
offsetthe offset at which to start writing
countthe number of bytes to write

Property Documentation

override bool Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CanRead
get

Indicates whether the stream supports reading.

override bool Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CanSeek
get

Indicates whether the stream supports seeking.

override bool Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.CanWrite
get

Indicates whether the stream supports writing.

Int32 Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Crc
get

Provides the current CRC for all blocks slurped in.

bool Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.LeaveOpen
getset

Indicates whether the underlying stream will be left open when the CrcCalculatorStream is Closed.

override long Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Length
get

Not implemented.

override long Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.Position
getset

Not implemented.

Int64 Electrotank.Electroserver5.Ionic.Zlib.CrcCalculatorStream.TotalBytesSlurped
get

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

This is either the total number of bytes read, or the total number of bytes written, depending on the direction of this stream.