diff --git a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
index 423f90837..42d533ce4 100644
--- a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
@@ -8,63 +8,74 @@
namespace Org.BouncyCastle.Cms
{
- /**
- * General class for generating a compressed CMS message stream.
- *
- * A simple example of usage.
- *
- *
- * CMSCompressedDataStreamGenerator gen = new CMSCompressedDataStreamGenerator();
- *
- * Stream cOut = gen.Open(outputStream, CMSCompressedDataStreamGenerator.ZLIB);
- *
- * cOut.Write(data);
- *
- * cOut.Close();
- *
- *
- * Stream handling note:
- *
- * - The returned Stream must be closed to finalize the CMS structure.
- * - Closing the returned stream does not close the underlying Stream
- * passed to {@code Open()}.
- * - Callers are responsible for closing the underlying Stream separately.
- *
- *
- */
+ ///
+ /// Streaming generator for CMS CompressedData messages. Call to obtain a
+ /// to which the content to be compressed is written; closing that stream finalizes the
+ /// CMS structure. Only ZLIB compression () is supported.
+ ///
+ ///
+ /// The returned stream must be closed (disposed) to finalize the CMS structure. Closing the returned stream
+ /// does not close the underlying stream passed to Open; callers are responsible for closing the
+ /// underlying stream separately.
+ /// A simple example of usage:
+ ///
+ /// CmsCompressedDataStreamGenerator gen = new CmsCompressedDataStreamGenerator();
+ /// using (Stream cOut = gen.Open(outputStream, CmsCompressedDataStreamGenerator.ZLib))
+ /// {
+ /// cOut.Write(data, 0, data.Length);
+ /// }
+ ///
+ ///
public class CmsCompressedDataStreamGenerator
{
+ /// The OID for ZLIB compression, the only algorithm supported by this generator.
public static readonly string ZLib = CmsObjectIdentifiers.ZlibCompress.Id;
private int m_bufferSize;
- /**
- * base constructor
- */
+ /// Creates a generator instance.
public CmsCompressedDataStreamGenerator()
{
}
- /**
- * Set the underlying string size for encapsulated data
- *
- * @param bufferSize length of octet strings to buffer the data.
- */
+ ///
+ /// Sets the buffer size used for the OCTET STRING segments holding the encapsulated content.
+ ///
+ /// The length, in bytes, of the octet strings used to buffer the data.
public void SetBufferSize(int bufferSize)
{
m_bufferSize = bufferSize;
}
+ ///
+ /// Opens a stream for generating a CMS CompressedData object using ZLIB compression and content type "data".
+ ///
+ /// The stream the CMS object is written to.
+ /// A stream the content to be compressed is written to; close it to finalize the structure.
public Stream Open(Stream outStream)
{
return Open(outStream, CmsObjectIdentifiers.Data.Id, ZLib);
}
+ ///
+ /// Opens a stream for generating a CMS CompressedData object with content type "data".
+ ///
+ /// The stream the CMS object is written to.
+ /// The compression algorithm OID; must be .
+ /// A stream the content to be compressed is written to; close it to finalize the structure.
public Stream Open(Stream outStream, string compressionOid)
{
return Open(outStream, CmsObjectIdentifiers.Data.Id, compressionOid);
}
+ ///
+ /// Opens a stream for generating a CMS CompressedData object with the given encapsulated content type.
+ ///
+ /// The stream the CMS object is written to.
+ /// The OID of the content type being compressed.
+ /// The compression algorithm OID; must be .
+ /// A stream the content to be compressed is written to; close it to finalize the structure.
+ /// Thrown if is not ZLIB.
public Stream Open(Stream outStream, string contentOid, string compressionOid)
{
if (ZLib != compressionOid)