01: package org.bouncycastle.mail.smime;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: import javax.mail.BodyPart;
07: import javax.mail.MessagingException;
08:
09: import org.bouncycastle.cms.CMSException;
10: import org.bouncycastle.cms.CMSProcessable;
11:
12: /**
13: * a holding class for a BodyPart to be processed.
14: */
15: public class CMSProcessableBodyPart implements CMSProcessable {
16: private BodyPart bodyPart;
17:
18: public CMSProcessableBodyPart(BodyPart bodyPart) {
19: this .bodyPart = bodyPart;
20: }
21:
22: public void write(OutputStream out) throws IOException,
23: CMSException {
24: try {
25: bodyPart.writeTo(out);
26: } catch (MessagingException e) {
27: throw new CMSException("can't write BodyPart to stream.", e);
28: }
29: }
30:
31: public Object getContent() {
32: return bodyPart;
33: }
34: }
|