Package net.rim.blackberry.api.mail

Examples of net.rim.blackberry.api.mail.SupportedAttachmentPart


      }
      //create a multipart
        Multipart mp = new Multipart();

        //create the file
        SupportedAttachmentPart sap = new SupportedAttachmentPart(mp,"application/x-example",attachment,data);

        TextBodyPart tbp = new TextBodyPart(mp, body);

        //add the file to the multipart
        mp.addBodyPart(tbp);
View Full Code Here


                    ++bodyPartIndex;
                }

                for (int i = 0; i < attachment.size(); i++) {

                    SupportedAttachmentPart sp =  new SupportedAttachmentPart(mp);

                    MailAttachment mailAttachment = (MailAttachment)attachment.elementAt(i);
                    sp.setFilename(mailAttachment.getFileName());

                    if (mailAttachment.getContentTransferEncoding().equals("base64")){
                        sp.setContent(new String(Base64.decode(mailAttachment.getactualContent().getBytes())));
                    }
                    else {
                        sp.setContent(mailAttachment.getactualContent());
                    }

                    sp.setContentType(mailAttachment.getContentType());
                    mp.addBodyPart(sp,bodyPartIndex);
                    ++bodyPartIndex;
                }

                msg.setContent(mp);
View Full Code Here

                    + e.toString()); // We couldn't find the proper format for
                                     // encoding!

        }

        final SupportedAttachmentPart bodypart =
                new SupportedAttachmentPart(multipart,
                        "text/calendar; component=vevent", "event.ics", bouts
                                .toByteArray());

        // Add attachment to multipart
        multipart.addBodyPart(new TextBodyPart(multipart, bouts.toString()));
View Full Code Here

        if (stream == null || stream.length == 0) {
            throw new IOException("Failed to read the file stream");
        }

        final SupportedAttachmentPart sap =
                new SupportedAttachmentPart(mp, MIMETypeAssociations
                        .getMIMEType(fileHolder.getFileName()), fileHolder
                        .getFileName(), stream);

        final TextBodyPart tbp = new TextBodyPart(mp, messageData);
        mp.addBodyPart(tbp);
View Full Code Here

                    final UnsupportedAttachmentPart uap =
                            (UnsupportedAttachmentPart) bodyPart;
                    name = uap.getName();
                } else // The bodyPart is a SupportedAttachmentPart
                {
                    final SupportedAttachmentPart sap =
                            (SupportedAttachmentPart) bodyPart;
                    name = sap.getName();
                }

                // Format the content type and name to display and store
                // the field.
                final StringBuffer sb =
View Full Code Here

TOP

Related Classes of net.rim.blackberry.api.mail.SupportedAttachmentPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.