Fingerprint_Card
Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream Class Reference

A special stream deflating or compressing the bytes that are written to it. It uses a Deflater to perform actual deflating.
Authors of the original java version : Tom Tromey, Jochen Hoenicke. More...

Inheritance diagram for ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream:
Collaboration diagram for ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream:

Public Member Functions

 DeflaterOutputStream (Stream baseOutputStream)
 Creates a new DeflaterOutputStream with a default Deflater and default buffer size.
 DeflaterOutputStream (Stream baseOutputStream, Deflater deflater)
 Creates a new DeflaterOutputStream with the given Deflater and default buffer size.
 DeflaterOutputStream (Stream baseOutputStream, Deflater deflater, int bufferSize)
 Creates a new DeflaterOutputStream with the given Deflater and buffer size.
virtual void Finish ()
 Finishes the stream by calling finish() on the deflater.
override long Seek (long offset, SeekOrigin origin)
 Sets the current position of this stream to the given value. Not supported by this class!
override void SetLength (long value)
 Sets the length of this stream to the given value. Not supported by this class!
override int ReadByte ()
 Read a byte from stream advancing position by one.
override int Read (byte[] buffer, int offset, int count)
 Read a block of bytes from stream.
override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 Asynchronous reads are not supported a NotSupportedException is always thrown.
override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 Asynchronous writes arent supported, a NotSupportedException is always thrown.
override void Flush ()
 Flushes the stream by calling Flush on the deflater and then on the underlying stream. This ensures that all bytes are flushed.
override void Close ()
 Calls Finish and closes the underlying stream when IsStreamOwner is true.
override void WriteByte (byte value)
 Writes a single byte to the compressed output stream.
override void Write (byte[] buffer, int offset, int count)
 Writes bytes from an array to the compressed stream.

Protected Member Functions

void EncryptBlock (byte[] buffer, int offset, int length)
 Encrypt a block of data.
void InitializePassword (string password)
 Initializes encryption keys based on given password .
void InitializeAESPassword (ZipEntry entry, string rawPassword, out byte[] salt, out byte[] pwdVerifier)
 Initializes encryption keys based on given password.
void Deflate ()
 Deflates everything in the input buffers. This will call.

Protected Attributes

byte[] AESAuthCode
 Returns the 10 byte AUTH CODE to be appended immediately following the AES data stream.
Deflater deflater_
 The deflater which is used to deflate the stream.
Stream baseOutputStream_
 Base stream the deflater depends on.

Properties

bool IsStreamOwner [get, set]
 Get/set flag indicating ownership of the underlying stream. When the flag is true Close will close the underlying stream also.
bool CanPatchEntries [get]
 Allows client to determine if an entry can be patched after its added.
string Password [get, set]
 Get/set the password used for encryption.
override bool CanRead [get]
 Gets value indicating stream can be read from.
override bool CanSeek [get]
 Gets a value indicating if seeking is supported for this stream This property always returns false.
override bool CanWrite [get]
 Get value indicating if this stream supports writing.
override long Length [get]
 Get current length of stream.
override long Position [get, set]
 Gets the current position within the stream.

Private Member Functions

void GetAuthCodeIfAES ()

Private Attributes

string password
ICryptoTransform cryptoTransform_
byte[] buffer_
 This buffer is used temporarily to retrieve the bytes from the deflater and write them to the underlying output stream.
bool isClosed_
bool isStreamOwner_ = true

Static Private Attributes

static RNGCryptoServiceProvider _aesRnd

Detailed Description

A special stream deflating or compressing the bytes that are written to it. It uses a Deflater to perform actual deflating.
Authors of the original java version : Tom Tromey, Jochen Hoenicke.

Constructor & Destructor Documentation

◆ DeflaterOutputStream() [1/3]

ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.DeflaterOutputStream ( Stream baseOutputStream)

Creates a new DeflaterOutputStream with a default Deflater and default buffer size.

Parameters
baseOutputStreamthe output stream where deflated output should be written.

◆ DeflaterOutputStream() [2/3]

ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.DeflaterOutputStream ( Stream baseOutputStream,
Deflater deflater )

Creates a new DeflaterOutputStream with the given Deflater and default buffer size.

Parameters
baseOutputStreamthe output stream where deflated output should be written.
deflaterthe underlying deflater.

◆ DeflaterOutputStream() [3/3]

ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.DeflaterOutputStream ( Stream baseOutputStream,
Deflater deflater,
int bufferSize )

Creates a new DeflaterOutputStream with the given Deflater and buffer size.

Parameters
baseOutputStreamThe output stream where deflated output is written.
deflaterThe underlying deflater to use
bufferSizeThe buffer size in bytes to use when deflating (minimum value 512)
Exceptions
ArgumentOutOfRangeExceptionbufsize is less than or equal to zero.
ArgumentExceptionbaseOutputStream does not support writing
ArgumentNullExceptiondeflater instance is null

Member Function Documentation

◆ BeginRead()

override IAsyncResult ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.BeginRead ( byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state )

Asynchronous reads are not supported a NotSupportedException is always thrown.

Parameters
bufferThe buffer to read into.
offsetThe offset to start storing data at.
countThe number of bytes to read
callbackThe async callback to use.
stateThe state to use.
Returns
Returns an IAsyncResult
Exceptions
NotSupportedExceptionAny access

◆ BeginWrite()

override IAsyncResult ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.BeginWrite ( byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state )

Asynchronous writes arent supported, a NotSupportedException is always thrown.

Parameters
bufferThe buffer to write.
offsetThe offset to begin writing at.
countThe number of bytes to write.
callbackThe AsyncCallback to use.
stateThe state object.
Returns
Returns an IAsyncResult.
Exceptions
NotSupportedExceptionAny access

◆ Close()

override void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Close ( )

Calls Finish and closes the underlying stream when IsStreamOwner is true.

Here is the call graph for this function:

◆ Deflate()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Deflate ( )
protected

Deflates everything in the input buffers. This will call.

def.deflate()

until all bytes from the input buffers are processed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EncryptBlock()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.EncryptBlock ( byte[] buffer,
int offset,
int length )
protected

Encrypt a block of data.

Parameters
bufferData to encrypt. NOTE the original contents of the buffer are lost
offsetOffset of first byte in buffer to encrypt
lengthNumber of bytes in buffer to encrypt
Here is the caller graph for this function:

◆ Finish()

virtual void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Finish ( )
virtual

Finishes the stream by calling finish() on the deflater.

Exceptions
SharpZipBaseExceptionNot all input is deflated

Reimplemented in ICSharpCode.SharpZipLib.GZip.GZipOutputStream, and ICSharpCode.SharpZipLib.Zip.ZipOutputStream.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Flush()

override void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Flush ( )

Flushes the stream by calling Flush on the deflater and then on the underlying stream. This ensures that all bytes are flushed.

Here is the call graph for this function:

◆ GetAuthCodeIfAES()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.GetAuthCodeIfAES ( )
private
Here is the caller graph for this function:

◆ InitializeAESPassword()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.InitializeAESPassword ( ZipEntry entry,
string rawPassword,
out byte[] salt,
out byte[] pwdVerifier )
protected

Initializes encryption keys based on given password.

Here is the caller graph for this function:

◆ InitializePassword()

void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.InitializePassword ( string password)
protected

Initializes encryption keys based on given password .

Parameters
passwordThe password.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

override int ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Read ( byte[] buffer,
int offset,
int count )

Read a block of bytes from stream.

Parameters
bufferThe buffer to store read data in.
offsetThe offset to start storing at.
countThe maximum number of bytes to read.
Returns
The actual number of bytes read. Zero if end of stream is detected.
Exceptions
NotSupportedExceptionAny access

◆ ReadByte()

override int ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.ReadByte ( )

Read a byte from stream advancing position by one.

Returns
The byte read cast to an int. THe value is -1 if at the end of the stream.
Exceptions
NotSupportedExceptionAny access

◆ Seek()

override long ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Seek ( long offset,
SeekOrigin origin )

Sets the current position of this stream to the given value. Not supported by this class!

Parameters
offsetThe offset relative to the origin to seek.
originThe SeekOrigin to seek from.
Returns
The new position in the stream.
Exceptions
NotSupportedExceptionAny access

◆ SetLength()

override void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.SetLength ( long value)

Sets the length of this stream to the given value. Not supported by this class!

Parameters
valueThe new stream length.
Exceptions
NotSupportedExceptionAny access

◆ Write()

override void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Write ( byte[] buffer,
int offset,
int count )

Writes bytes from an array to the compressed stream.

Parameters
bufferThe byte array
offsetThe offset into the byte array where to start.
countThe number of bytes to write.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteByte()

override void ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.WriteByte ( byte value)

Writes a single byte to the compressed output stream.

Parameters
valueThe byte value.
Here is the call graph for this function:

Member Data Documentation

◆ _aesRnd

RNGCryptoServiceProvider ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream._aesRnd
staticprivate

◆ AESAuthCode

byte [] ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.AESAuthCode
protected

Returns the 10 byte AUTH CODE to be appended immediately following the AES data stream.

◆ baseOutputStream_

Stream ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.baseOutputStream_
protected

Base stream the deflater depends on.

◆ buffer_

byte [] ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.buffer_
private

This buffer is used temporarily to retrieve the bytes from the deflater and write them to the underlying output stream.

◆ cryptoTransform_

ICryptoTransform ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.cryptoTransform_
private

◆ deflater_

Deflater ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.deflater_
protected

The deflater which is used to deflate the stream.

◆ isClosed_

bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.isClosed_
private

◆ isStreamOwner_

bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.isStreamOwner_ = true
private

◆ password

string ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.password
private

Property Documentation

◆ CanPatchEntries

bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.CanPatchEntries
get

Allows client to determine if an entry can be patched after its added.

◆ CanRead

override bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.CanRead
get

Gets value indicating stream can be read from.

◆ CanSeek

override bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.CanSeek
get

Gets a value indicating if seeking is supported for this stream This property always returns false.

◆ CanWrite

override bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.CanWrite
get

Get value indicating if this stream supports writing.

◆ IsStreamOwner

bool ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.IsStreamOwner
getset

Get/set flag indicating ownership of the underlying stream. When the flag is true Close will close the underlying stream also.

◆ Length

override long ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Length
get

Get current length of stream.

◆ Password

string ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Password
getset

Get/set the password used for encryption.

When set to null or if the password is empty no encryption is performed

◆ Position

override long ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream.Position
getset

Gets the current position within the stream.

Exceptions
NotSupportedExceptionAny attempt to set position

The documentation for this class was generated from the following file: