public abstract class SMimeContent extends java.lang.Object implements CryptoContent
EncryptedContent
and CompressedContent
.
Some of these method are also used by SignedContent
, but are
reimplemented there because multiple inheritence is not supported by Java.EncryptedContent
,
CompressedContent
Modifier | Constructor and Description |
---|---|
protected |
SMimeContent()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getContent()
Returns the content as a Java object.
|
java.lang.String |
getContentType()
Returns the ContentType header and any attached parameters.
|
abstract jakarta.activation.DataHandler |
getDataHandler()
Returns a DataHandler holding the content.
|
java.io.InputStream |
getInputStream()
Returns an InputStream from which the content can be read.
|
void |
setBlockSize(int blockSize)
Sets the block size for defining the length of each definite primitive
encoded octet string component.
|
void |
setContent(jakarta.mail.Multipart multipart)
Supplies the content as MIME Multipart.
|
void |
setContent(java.lang.Object content,
java.lang.String type)
Sets the content to be processed.
|
void |
setContentContentHeaders(jakarta.mail.Header[] headers)
Set some headers for the entity to be signed.
|
void |
setContentContentTransferEncoding(java.lang.String cte)
Sets the content transfer encoding of the entity to be signed.
|
void |
setDataHandler(jakarta.activation.DataHandler dataHandler)
Sets the content wrapped by a
jakarta.activation.DataHandler . |
void |
setText(java.lang.String text)
Sets the text content.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSMimeType, setHeaders
public java.lang.String getContentType()
EncryptedContent
, or CompressedContent
as the content
of a MimeMessage, e.g.:
MimeMessage msg = ...; EncryptedContent ec = new EncryptedContent(); msg.setContent(ec, ec.getContentType()); ...or
MimeMessage msg = ...; CompressedContent compressed = ...; ... msg.setContent(compressed, compressed.getContentType()); ...
getContentType
in interface CryptoContent
public void setContent(java.lang.Object content, java.lang.String type) throws jakarta.mail.MessagingException
content
- a Java objecttype
- MIME type of this objectjakarta.mail.MessagingException
- if an error occurs while preparing the contentpublic void setContent(jakarta.mail.Multipart multipart) throws jakarta.mail.MessagingException
multipart
- the multipart contentjakarta.mail.MessagingException
- if an error occurs while preparing the contentpublic void setText(java.lang.String text) throws jakarta.mail.MessagingException
text
- the text contentjakarta.mail.MessagingException
- if an error occurs while preparing the contentpublic void setDataHandler(jakarta.activation.DataHandler dataHandler) throws jakarta.mail.MessagingException
jakarta.activation.DataHandler
.
The DataHandler wraps around the actual content.
For more information about DataHandler usage see the JavaBeans Activation Framework (JAF) sepecification.
dataHandler
- the DataHandler with the content to be compressedjakarta.mail.MessagingException
- if an error occurs while preparing the contentpublic java.lang.Object getContent() throws java.io.IOException, jakarta.mail.MessagingException
java.io.IOException
- if an I/O error occurs when getting the content from the inherent data handlerjakarta.mail.MessagingException
- if an error occurs when fetching the inherent data handlerpublic abstract jakarta.activation.DataHandler getDataHandler() throws jakarta.mail.MessagingException
jakarta.mail.MessagingException
- if an error occurs when fetching the data handlerpublic java.io.InputStream getInputStream() throws java.io.IOException, jakarta.mail.MessagingException
java.io.IOException
- if an I/O error occurs when getting the input stream from the inherent data handlerjakarta.mail.MessagingException
- if an error occurs when fetching the inherent data handlerpublic void setContentContentTransferEncoding(java.lang.String cte)
setText
or
setDataHandler
has been used for
supplying the content. This method maybe called BEFORE setting the content
(to avoid header update overhead during the saveChanges run).cte
- the content transfer encoding to be applied to the
inner entity to be signedpublic void setContentContentHeaders(jakarta.mail.Header[] headers)
setText
or
setDataHandler
has been used for
supplying the content. This method maybe called BEFORE setting the content
(to avoid header update overhead during the saveChanges run).headers
- the headers to be applied to the
inner entity to be signedpublic void setBlockSize(int blockSize)
blockSize
is smaller or equal to zero the
whole encrypted data is encoded as definite primitive octet string.blockSize
- for defining the encoding scheme and setting the octet
string component length, if positive