public class AttachmentUtils extends Object
EmailAttachment objects.
| Constructor and Description |
|---|
AttachmentUtils() |
| Modifier and Type | Method and Description |
|---|---|
EmailAttachment |
create(String pathToFile)
Creates an object of the
EmailAttachment class by the path to file. |
EmailAttachment |
create(String pathToFile,
FileParametersDetector detector)
Creates an object of the
EmailAttachment class by the path to file argument
The path to file must start with the following prefixes: "file://", "classpath:" or a path separator. |
String |
createContentTypeForAttachment(File file)
This method creates string for the value of Content-Type header.
|
String |
createContentTypeForAttachment(File file,
FileParametersDetector detector)
This method creates string for the value of Content-Type header.
|
File |
createFile(String pathToFile)
Creates a file object from the file path argument.
|
public File createFile(String pathToFile) throws AttachmentException
pathToFile - the path to fileFileAttachmentException - exception may occur when the file path doesn't satisfy conditions or doesn't parsepublic EmailAttachment create(String pathToFile) throws AttachmentException
EmailAttachment class by the path to file.AttachmentExceptioncreate(String, FileParametersDetector)public EmailAttachment create(String pathToFile, FileParametersDetector detector) throws AttachmentException
EmailAttachment class by the path to file argument
The path to file must start with the following prefixes: "file://", "classpath:" or a path separator.
Relatives paths is not supported.pathToFile - the path to fileEmailAttachment classAttachmentException - exception may occur when the file path doesn't satisfy conditions or doesn't parse.
Also, an exception may occur while reading the file.public String createContentTypeForAttachment(File file)
public String createContentTypeForAttachment(File file, FileParametersDetector detector)
file - a path to the filedetector - FileParametersDetector detector for getting different file parametersCopyright © 2023. All rights reserved.