Class CMSCompressedDataStreamGenerator

java.lang.Object
org.bouncycastle.cms.CMSCompressedDataStreamGenerator

public class CMSCompressedDataStreamGenerator extends Object
General class for generating a compressed CMS message stream.

A simple example of usage.

      CMSCompressedDataStreamGenerator gen = new CMSCompressedDataStreamGenerator();
      
      OutputStream cOut = gen.open(outputStream, new ZlibCompressor());
      
      cOut.write(data);
      
      cOut.close();
 
  • Field Details

    • ZLIB

      public static final String ZLIB
  • Constructor Details

    • CMSCompressedDataStreamGenerator

      public CMSCompressedDataStreamGenerator()
      base constructor
  • Method Details

    • setBufferSize

      public void setBufferSize(int bufferSize)
      Set the underlying string size for encapsulated data
      Parameters:
      bufferSize - length of octet strings to buffer the data.
    • open

      public OutputStream open(OutputStream out, OutputCompressor compressor) throws IOException
      Open a compressing output stream with the PKCS#7 content type OID of "data".
      Parameters:
      out - the stream to encode to.
      compressor - the type of compressor to use.
      Returns:
      an output stream to write the data be compressed to.
      Throws:
      IOException
    • open

      public OutputStream open(org.bouncycastle.asn1.ASN1ObjectIdentifier contentOID, OutputStream out, OutputCompressor compressor) throws IOException
      Open a compressing output stream.
      Parameters:
      contentOID - the content type OID.
      out - the stream to encode to.
      compressor - the type of compressor to use.
      Returns:
      an output stream to write the data be compressed to.
      Throws:
      IOException