Table of Contents

Class PgpCompressedDataGenerator

Namespace
Org.BouncyCastle.Bcpg.OpenPgp
Assembly
BouncyCastle.Cryptography.dll
public class PgpCompressedDataGenerator : IStreamGenerator
Inheritance
PgpCompressedDataGenerator
Implements
Inherited Members

Remarks

Class for producing compressed data packets.

Constructors

PgpCompressedDataGenerator(CompressionAlgorithmTag)

public PgpCompressedDataGenerator(CompressionAlgorithmTag algorithm)

Parameters

algorithm CompressionAlgorithmTag

PgpCompressedDataGenerator(CompressionAlgorithmTag, int)

public PgpCompressedDataGenerator(CompressionAlgorithmTag algorithm, int compression)

Parameters

algorithm CompressionAlgorithmTag
compression int

Methods

Close()

[Obsolete("Dispose any opened Stream directly")]
public void Close()

Open(Stream)

Return an output stream which will save the data being written to the compressed object.

The stream created can be closed off by either calling Close() on the stream or Close() on the generator. Closing the returned stream does not close off the Stream parameter outStr.

public Stream Open(Stream outStr)

Parameters

outStr Stream

Stream to be used for output.

Returns

Stream

A Stream for output of the compressed data.

Exceptions

ArgumentNullException
InvalidOperationException
IOException

Open(Stream, byte[])

Return an output stream which will compress the data as it is written to it. The stream will be written out in chunks according to the size of the passed in buffer.

The stream created can be closed off by either calling Close() on the stream or Close() on the generator. Closing the returned stream does not close off the Stream parameter outStr.

Note: if the buffer is not a power of 2 in length only the largest power of 2 bytes worth of the buffer will be used.

Note: using this may break compatibility with RFC 1991 compliant tools. Only recent OpenPGP implementations are capable of accepting these streams.

public Stream Open(Stream outStr, byte[] buffer)

Parameters

outStr Stream

Stream to be used for output.

buffer byte[]

The buffer to use.

Returns

Stream

A Stream for output of the compressed data.

Exceptions

ArgumentNullException
InvalidOperationException
IOException
PgpException