01: package org.bouncycastle.mail.smime.examples;
02:
03: import java.util.Properties;
04:
05: import javax.mail.Session;
06: import javax.mail.internet.MimeBodyPart;
07: import javax.mail.internet.MimeMessage;
08:
09: import org.bouncycastle.mail.smime.SMIMECompressedParser;
10: import org.bouncycastle.mail.smime.SMIMEUtil;
11: import org.bouncycastle.mail.smime.util.SharedFileInputStream;
12:
13: /**
14: * a simple example that reads an oversize compressed email and writes data contained
15: * in the compressed part into a file.
16: */
17: public class ReadLargeCompressedMail {
18: public static void main(String args[]) throws Exception {
19: //
20: // Get a Session object with the default properties.
21: //
22: Properties props = System.getProperties();
23:
24: Session session = Session.getDefaultInstance(props, null);
25:
26: MimeMessage msg = new MimeMessage(session,
27: new SharedFileInputStream("compressed.message"));
28:
29: SMIMECompressedParser m = new SMIMECompressedParser(msg);
30: MimeBodyPart res = SMIMEUtil.toMimeBodyPart(m.getContent());
31:
32: ExampleUtils.dumpContent(res, args[0]);
33: }
34: }
|