本文整理了Java中javax.mail.internet.MimeBodyPart.saveFile()
方法的一些代码示例,展示了MimeBodyPart.saveFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.saveFile()
方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称: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
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Save the body part content to a given target file.
*
* @param file The file name used to store the information.
*
* @exception IOException
* @exception MessagingException
*/
public void saveFile(String file) throws IOException, MessagingException {
saveFile(new File(file));
}
}
代码示例来源:origin: javax.mail/javax.mail-api
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: javax.mail/com.springsource.javax.mail
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: com.sun.mail/mailapi
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: com.sun.mail/android-mail
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: com.sun.mail/jakarta.mail
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: org.glassfish.metro/webservices-extra
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: jboss/jboss-javaee-specs
/**
* Save the contents of this part in the specified file. The content
* is decoded and saved, without any of the MIME headers.
*
* @param file the name of the file to write to
* @exception IOException errors related to accessing the file
* @exception MessagingException message related errors
* @since JavaMail 1.4
*/
public void saveFile(String file) throws IOException, MessagingException {
File f = new File(file);
saveFile(f);
}
代码示例来源:origin: stackoverflow.com
part.saveFile(new File(request
.getSession()
.getServletContext()
part.saveFile(new File(request
.getSession()
.getServletContext()
part.saveFile(new File(request
.getSession()
.getServletContext()
代码示例来源:origin: stackoverflow.com
part.saveFile(new File(request
.getSession()
.getServletContext()
part.saveFile(new File(request
.getSession()
.getServletContext()
part.saveFile(new File(request
.getSession()
.getServletContext()
代码示例来源:origin: stackoverflow.com
String contentType = message.getContentType();
String messageContent = "";
if (contentType.contains("multipart")) {
// content may contain attachments
Multipart multiPart = (Multipart) message.getContent();
int numberOfParts = multiPart.getCount();
for (int partCount = 0; partCount < numberOfParts; partCount++) {
MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(partCount);
if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
// this part is attachment
String fileName = part.getFileName();
attachFiles += fileName + ", ";
part.saveFile(saveDirectory + File.separator + fileName);
} else {
// this part may be the message content
messageContent = part.getContent().toString();
}
}
if (attachFiles.length() > 1) {
attachFiles = attachFiles.substring(0, attachFiles.length() - 2);
}
} else if (contentType.contains("text/plain")
|| contentType.contains("text/html")) {
Object content = message.getContent();
if (content != null) {
messageContent = content.toString();
}
}
代码示例来源:origin: stackoverflow.com
private void saveAttachments(Message[] messages) throws Exception {
for (Message msg : messages) {
if (msg.getContent() instanceof Multipart) {
Multipart multipart = (Multipart) msg.getContent();
for (int i = 0; i < multipart.getCount(); i++) {
Part part = multipart.getBodyPart(i);
String disposition = part.getDisposition();
if ((disposition != null) &&
((disposition.equalsIgnoreCase(Part.ATTACHMENT) ||
(disposition.equalsIgnoreCase(Part.INLINE))))) {
MimeBodyPart mimeBodyPart = (MimeBodyPart) part;
String fileName = mimeBodyPart.getFileName();
File fileToSave = new File(fileName);
mimeBodyPart.saveFile(fileToSave);
}
}
}
}
}
代码示例来源:origin: stackoverflow.com
part.saveFile(file);
代码示例来源:origin: stackoverflow.com
part.saveFile(saveDirectory + File.separator + fileName);
} else {
内容来源于网络,如有侵权,请联系作者删除!