public class CompressedData extends CompressedDataStream implements Content
contentType, DEFAULT_BLOCKSIZE, EXPLICIT, IMPLICIT, m_blockSize, m_compressionAlgorithm, m_encapContentType, m_inputStream, m_version| Modifier | Constructor and Description |
|---|---|
protected |
CompressedData()
Default constructor for dynamic object creation in ContentInfo.
|
|
CompressedData(byte[] content,
AlgorithmID algorithmid,
int mode)
Creates a new CompressedData object where the content to be compressed is
read from the supplied byte array using the Algorithm specified by the
AlgorithmID.
|
|
CompressedData(java.io.InputStream inputstream)
Creates a new CompressedData where the DER encoded data is read from the
given InputStream.
|
|
CompressedData(ObjectID objectid,
byte[] data,
AlgorithmID algorithmid,
int mode)
Creates a new CompressedData object where the content to be compressed is
read from the supplied byte array using the Algorithm specified by the
AlgorithmID.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object asn1object)
Decodes the given CompressedData ASN1 object.
|
byte[] |
getContent()
Returns the content as byte array.
|
byte[] |
getEncoded()
Returns the DER encoding of this CompressedData in a byte array.
|
java.io.InputStream |
getInputStream()
This method will return an InputStream which can be used to read the
compressed or decompressed content.
|
void |
setContent(byte[] content)
Sets the content to be compressed/decompressed.
|
protected ASN1Object |
toASN1Object(int blocksize)
Returns this
CompressedData as ASN1Object where a
constructed OCTET STRING is used for encoding the encrypted content. |
decode, getBlockSize, getCompressionAlgorithm, getCompressionProvider, getContentType, getEncapsulatedContentInfoStream, getEncapsulatedContentType, getMode, getVersion, setBlockSize, setCompressionProvider, setInputStream, toASN1Object, toString, toString, writeTo, writeToclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdecode, getBlockSize, getContentType, setBlockSize, toASN1Object, toStringpublic CompressedData(byte[] content,
AlgorithmID algorithmid,
int mode)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
content - the byte array containing the data to compressalgorithmid - the algorithm used to compress the datamode - the mode CompressedData.IMPLICIT (to include data) or
CompressedData.EXPLICIT (to not include the data).java.io.IOException - if an I/O error occursjava.security.NoSuchAlgorithmException - if algorithm not availablepublic CompressedData(java.io.InputStream inputstream)
throws CMSParsingException,
java.io.IOException
inputstream - the InputStream holding a DER encoded CMS CompressedData
objectjava.io.IOException - if an I/O error occurs during reading from the InputStreamCMSParsingException - if an error occurs while parsing the objectpublic CompressedData(ObjectID objectid, byte[] data, AlgorithmID algorithmid, int mode) throws java.io.IOException, java.security.NoSuchAlgorithmException
Data.objectid - the content type of the data to be compresseddata - the byte array containing the data to compressalgorithmid - the algorithm used to compress the datamode - the mode CompressedData.IMPLICIT (to include data) or
CompressedData.EXPLICIT (to not include the data).java.io.IOException - if an I/O error occursjava.security.NoSuchAlgorithmException - if the compression algorithm is not specifiedprotected CompressedData()
protected ASN1Object toASN1Object(int blocksize) throws CMSException
CompressedData as ASN1Object where a
constructed OCTET STRING is used for encoding the encrypted content.toASN1Object in class CompressedDataStreamblocksize - the block size defining the encoding scheme - and specifying
the length of each primitive encoded octet string component,
if positiveEncryptedData as ASN1ObjectCMSException - if the ASN1Object could not be createdpublic void setContent(byte[] content)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
content - the raw/compressed contentjava.security.NoSuchAlgorithmException - if the requested compresesion algorithm is not supportedjava.io.IOException - if an I/O error occurspublic java.io.InputStream getInputStream()
throws java.io.IOException,
java.security.NoSuchAlgorithmException
getInputStream in class CompressedDataStreamjava.io.IOException - if an I/O error occursjava.security.NoSuchAlgorithmException - if the requested compresesion algorithm is not supportedpublic byte[] getEncoded()
throws CMSException
If the blockSize value of the inherent
EncryptedContentInfostructure has
been set to a positive value, the encrypted content is encoded as
indefinite constructed octet string being composed of a certain number of
definite primitive encoded octet strings of blockSize
length. If no - or a not-positive - blockSize value has been specified
whole the encrypted content will be encoded as definite primitive octet
string.
CMSException - if an error occurs during the encoding procedurepublic byte[] getContent()
throws java.io.IOException,
java.security.NoSuchAlgorithmException
The returned content depends on whether creating a new CompressedData or parsing an existing one:
java.io.IOException - if an I/O error occursjava.security.NoSuchAlgorithmExceptionpublic void decode(ASN1Object asn1object) throws CMSParsingException
decode in interface Contentasn1object - the ASN1Object representing an already exisiting
CompressedData objectCMSParsingException - if an error occurs when parsing the given ASN1Object