All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.featherfly.common.net.mail.MailAttach Maven / Gradle / Ivy


package cn.featherfly.common.net.mail;

import java.io.File;

import cn.featherfly.common.lang.AssertIllegalArgument;
import cn.featherfly.common.lang.LangUtils;

/**
 * 

* MailAttach *

* * @author 钟冀 */ public class MailAttach { private String fileName; private File file; /** */ public MailAttach(File file) { init(file, null); } /** */ public MailAttach(File file, String fileName) { init(file, fileName); } private void init(File file, String fileName) { AssertIllegalArgument.isNotNull(file, "文件不能为null"); AssertIllegalArgument.isFalse(!file.exists(), "文件不存在"); this.file = file; if (LangUtils.isEmpty(fileName)) { this.fileName = file.getName(); } else { this.fileName = fileName; } } /** * 返回fileName * @return fileName */ public String getFileName() { return fileName; } /** * 返回file * @return file */ public File getFile() { return file; } /** * {@inheritDoc} */ @Override public String toString() { return file.getAbsolutePath() + " : " + fileName; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy