javax.mail.internet.MimeBodyPart.saveFile()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(289)

本文整理了Java中javax.mail.internet.MimeBodyPart.saveFile()方法的一些代码示例,展示了MimeBodyPart.saveFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.saveFile()方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称:MimeBodyPart
方法名:saveFile

MimeBodyPart.saveFile介绍

[英]Save the contents of this part in the specified file. The content is decoded and saved, without any of the MIME headers.
[中]将此部件的内容保存到指定的文件中。内容被解码并保存,没有任何MIME头。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: com.sun.mail/javax.mail

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

  1. /**
  2. * Save the body part content to a given target file.
  3. *
  4. * @param file The file name used to store the information.
  5. *
  6. * @exception IOException
  7. * @exception MessagingException
  8. */
  9. public void saveFile(String file) throws IOException, MessagingException {
  10. saveFile(new File(file));
  11. }
  12. }

代码示例来源:origin: javax.mail/javax.mail-api

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: javax.mail/com.springsource.javax.mail

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: com.sun.mail/mailapi

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: com.sun.mail/android-mail

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: com.sun.mail/jakarta.mail

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: org.glassfish.metro/webservices-extra

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: jboss/jboss-javaee-specs

  1. /**
  2. * Save the contents of this part in the specified file. The content
  3. * is decoded and saved, without any of the MIME headers.
  4. *
  5. * @param file the name of the file to write to
  6. * @exception IOException errors related to accessing the file
  7. * @exception MessagingException message related errors
  8. * @since JavaMail 1.4
  9. */
  10. public void saveFile(String file) throws IOException, MessagingException {
  11. File f = new File(file);
  12. saveFile(f);
  13. }

代码示例来源:origin: stackoverflow.com

  1. part.saveFile(new File(request
  2. .getSession()
  3. .getServletContext()
  4. part.saveFile(new File(request
  5. .getSession()
  6. .getServletContext()
  7. part.saveFile(new File(request
  8. .getSession()
  9. .getServletContext()

代码示例来源:origin: stackoverflow.com

  1. part.saveFile(new File(request
  2. .getSession()
  3. .getServletContext()
  4. part.saveFile(new File(request
  5. .getSession()
  6. .getServletContext()
  7. part.saveFile(new File(request
  8. .getSession()
  9. .getServletContext()

代码示例来源:origin: stackoverflow.com

  1. String contentType = message.getContentType();
  2. String messageContent = "";
  3. if (contentType.contains("multipart")) {
  4. // content may contain attachments
  5. Multipart multiPart = (Multipart) message.getContent();
  6. int numberOfParts = multiPart.getCount();
  7. for (int partCount = 0; partCount < numberOfParts; partCount++) {
  8. MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(partCount);
  9. if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
  10. // this part is attachment
  11. String fileName = part.getFileName();
  12. attachFiles += fileName + ", ";
  13. part.saveFile(saveDirectory + File.separator + fileName);
  14. } else {
  15. // this part may be the message content
  16. messageContent = part.getContent().toString();
  17. }
  18. }
  19. if (attachFiles.length() > 1) {
  20. attachFiles = attachFiles.substring(0, attachFiles.length() - 2);
  21. }
  22. } else if (contentType.contains("text/plain")
  23. || contentType.contains("text/html")) {
  24. Object content = message.getContent();
  25. if (content != null) {
  26. messageContent = content.toString();
  27. }
  28. }

代码示例来源:origin: stackoverflow.com

  1. private void saveAttachments(Message[] messages) throws Exception {
  2. for (Message msg : messages) {
  3. if (msg.getContent() instanceof Multipart) {
  4. Multipart multipart = (Multipart) msg.getContent();
  5. for (int i = 0; i < multipart.getCount(); i++) {
  6. Part part = multipart.getBodyPart(i);
  7. String disposition = part.getDisposition();
  8. if ((disposition != null) &&
  9. ((disposition.equalsIgnoreCase(Part.ATTACHMENT) ||
  10. (disposition.equalsIgnoreCase(Part.INLINE))))) {
  11. MimeBodyPart mimeBodyPart = (MimeBodyPart) part;
  12. String fileName = mimeBodyPart.getFileName();
  13. File fileToSave = new File(fileName);
  14. mimeBodyPart.saveFile(fileToSave);
  15. }
  16. }
  17. }
  18. }
  19. }

代码示例来源:origin: stackoverflow.com

  1. part.saveFile(file);

代码示例来源:origin: stackoverflow.com

  1. part.saveFile(saveDirectory + File.separator + fileName);
  2. } else {

相关文章