public class CMSCompressedDataOutputStream extends CMSOutputStream
CMSCompressedDataOutputStream writes its output in the form of a CMS
digested-data structure, generating the message digest in the process.
Specifically, the effect of using this class is as if the following process took place:
digested-data.
except that the actual process is done in one pass, eliminating the necessity to accumulate all of the input data before writing any output.
In the case where a CMSConnector is provided instead of a CMSOutputStream, only the
exposed content i.e. the Content field of the ContentInfo structure minus the
explicit [0] tag is written to the underlying output stream.
IMPORTANT: This class generates large CMS digested-data Objects more efficiently (Java VM memory usage) than the
CMSCompressedDataContentInfo class.
| Constructor and Description |
|---|
CMSCompressedDataOutputStream(CMSOutputConnector conn,
AlgorithmIdentifier digestAlgID,
ASN1ObjectID contentType)
Creates a
CMSCompressedDataOutputStream. |
CMSCompressedDataOutputStream(java.io.OutputStream out,
AlgorithmIdentifier compressionAlgID,
ASN1ObjectID contentType)
Creates a
CMSCompressedDataOutputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
ASN1ObjectID |
getExposedContentType()
Returns the content type of the data that is output to the underlying output stream.
|
void |
terminate()
Finish writing the CMS
compressed-data structure. |
void |
write(byte[] b,
int off,
int len) |
void |
write(int ch) |
public CMSCompressedDataOutputStream(java.io.OutputStream out,
AlgorithmIdentifier compressionAlgID,
ASN1ObjectID contentType)
throws AlgorithmIdentifierException
CMSCompressedDataOutputStream.out - The underlying output stream.compressionAlgID - The compression algorithm.contentType - The encapsulated content type.AlgorithmIdentifierException - Digest algorithm is not supported.public CMSCompressedDataOutputStream(CMSOutputConnector conn, AlgorithmIdentifier digestAlgID, ASN1ObjectID contentType) throws AlgorithmIdentifierException
CMSCompressedDataOutputStream.conn - The underlying output connector.digestAlgID - The message digest algorithm.contentType - The encapsulated content type.AlgorithmIdentifierException - Digest algorithm is not supported.public void terminate()
throws java.io.IOException
compressed-data structure.
This method must be called after the content has been completely written.
terminate in class CMSOutputStreamjava.io.IOException - An I/O error occurred.public void write(int ch)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.FilterOutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOExceptionpublic ASN1ObjectID getExposedContentType()
getExposedContentType in class CMSOutputStream