Package com.independentsoft.email.mime
Class Attachment
java.lang.Object
com.independentsoft.email.mime.Attachment
Class Attachment.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of the Attachment class.Attachment(byte[] buffer)Initializes a new instance of the Attachment class.Attachment(byte[] buffer, String name)Initializes a new instance of the Attachment class.Attachment(InputStream stream)Initializes a new instance of the Attachment class.Attachment(InputStream stream, String name)Initializes a new instance of the Attachment class.Attachment(String filePath)Initializes a new instance of the Attachment class. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBytes()Gets the bytes.Gets the content description.Gets the content disposition.Gets the content identifier.Gets the content location.Gets the type of the content.Gets the name of the file.getName()Gets the name.Gets the stream.voidOpens the specified file path.voidsave(OutputStream stream)Saves the specified stream.voidSaves this attachment to the specified file.voidSaves this attachment to the specified file.voidsetContentDescription(String contentDescription)Sets the content description.voidsetContentDisposition(ContentDisposition contentDisposition)Sets the content disposition.voidsetContentID(String contentID)Sets the content identifier.voidsetContentLocation(String contentLocation)Sets the content location.voidsetContentType(ContentType contentType)Sets the type of the content.voidSets the name.toString()Returns a String that represents this instance.
-
Constructor Details
-
Attachment
public Attachment()Initializes a new instance of the Attachment class. -
Attachment
Initializes a new instance of the Attachment class.- Parameters:
filePath- The file path.- Throws:
IOException- if an I/O error occurs.
-
Attachment
Initializes a new instance of the Attachment class.- Parameters:
stream- The stream.- Throws:
IOException- if an I/O error occurs.
-
Attachment
public Attachment(byte[] buffer)Initializes a new instance of the Attachment class.- Parameters:
buffer- The buffer.
-
Attachment
Initializes a new instance of the Attachment class.- Parameters:
stream- The stream.name- The name.- Throws:
IOException- if an I/O error occurs.
-
Attachment
Initializes a new instance of the Attachment class.- Parameters:
buffer- The buffer.name- The name.
-
-
Method Details
-
open
Opens the specified file path.- Parameters:
filePath- The file path.- Throws:
IOException- if an I/O error occurs.
-
save
Saves the specified stream.- Parameters:
stream- The stream.- Throws:
IOException- if an I/O error occurs.
-
save
Saves this attachment to the specified file.- Parameters:
filePath- File path.- Throws:
IOException- if an I/O error occurs.
-
save
Saves this attachment to the specified file.- Parameters:
filePath- File path.overwrite- True to overwrite existing file, otherwise false.- Throws:
IOException- if an I/O error occurs.
-
getStream
Gets the stream.- Returns:
- Stream.
-
getBytes
public byte[] getBytes()Gets the bytes.- Returns:
- The bytes.
-
getFileName
Gets the name of the file.- Returns:
- The file name.
-
toString
Returns a String that represents this instance. -
getName
Gets the name.- Returns:
- The name.
-
setName
Sets the name.- Parameters:
name- The name.
-
getContentType
Gets the type of the content.- Returns:
- The type of the content.
-
setContentType
Sets the type of the content.- Parameters:
contentType- The type of the content.
-
getContentID
Gets the content identifier.- Returns:
- The content identifier.
-
setContentID
Sets the content identifier.- Parameters:
contentID- The content identifier.
-
getContentLocation
Gets the content location.- Returns:
- The content location.
-
setContentLocation
Sets the content location.- Parameters:
contentLocation- The content location.
-
getContentDescription
Gets the content description.- Returns:
- The content description.
-
setContentDescription
Sets the content description.- Parameters:
contentDescription- The content description.
-
getContentDisposition
Gets the content disposition.- Returns:
- The content disposition.
-
setContentDisposition
Sets the content disposition.- Parameters:
contentDisposition- The content disposition.
-