public class encrypted_content
extends java.lang.Object
implements jakarta.activation.DataContentHandler
Within the Jakarta Activation Framework (JAF) data content handlers are used for writing certain data objects to streams, and parsing objects back from streams. Generally, applications do not immediately call the methods of a data content handler. Rather they use the access mechanisms provided by the corresponding DataHandler. The data handler itself internally will look for a proper data content handler supporting a the requested S/MIME type.
The JAF uses a RFC1524 mailcap file
for defining Java classes as content handlers for specific mime types. In
particular, this encrypted_content class acts as a content handler
for the S/MIME type application/x-pkcs7-mime, indicated by the following
statement in the corresponding mailcap file::
application/x-pkcs7-mime;; x-java-content-handler=iaik.security.smime.encrypted_contentAnd for recognizing the new content type:
application/pkcs7-mime;; x-java-content-handler=iaik.security.smime.encrypted_contentNote that the IAIK-S/MIME distribution includes a ready-to-use mailcap file to be copied in the lib directory of your JDK (
More information about the Jakarta Activation API may be obtained from https://projects.eclipse.org/projects/ee4j.jaf.
| Constructor and Description |
|---|
encrypted_content()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getContent(jakarta.activation.DataSource dataSource)
Returns an object representing the data which is encapsulated by the
supplied dataSource.
|
java.lang.Object |
getTransferData(jakarta.activation.ActivationDataFlavor df,
jakarta.activation.DataSource ds) |
jakarta.activation.ActivationDataFlavor[] |
getTransferDataFlavors() |
void |
writeTo(java.lang.Object o,
java.lang.String mimeType,
java.io.OutputStream os)
Writes the supplied object to the given output stream.
|
public java.lang.Object getContent(jakarta.activation.DataSource dataSource)
throws java.io.IOException
getContent in interface jakarta.activation.DataContentHandlerdataSource - the data source supplying the encapsulated dataEncryptedContent or
SignedContent object
representing the supplied datajava.io.IOException - if an error occurs when parsing the datapublic void writeTo(java.lang.Object o,
java.lang.String mimeType,
java.io.OutputStream os)
throws java.io.IOException
This method only is able to handle objects supplied as instances
of EncryptedContent or
SignedContent. If
the given object does not satisfy this criterion, an IOException is thrown.
writeTo in interface jakarta.activation.DataContentHandlero - the object (an instance of EncryptedContent or SignedContent) to
be written to the streammimeType - the mimeType; not used hereos - the output stream to which to write the datajava.io.IOException - if the supplied object is not an instance of
SignedContent or EncryptedContent, or an error occurs while
writing to the streampublic java.lang.Object getTransferData(jakarta.activation.ActivationDataFlavor df,
jakarta.activation.DataSource ds)
throws java.io.IOException
getTransferData in interface jakarta.activation.DataContentHandlerjava.io.IOExceptionpublic jakarta.activation.ActivationDataFlavor[] getTransferDataFlavors()
getTransferDataFlavors in interface jakarta.activation.DataContentHandler