public class FileAttachment extends Attachment
| Constructor and Description |
|---|
FileAttachment()
Initializes a new instance of the FileAttachment class.
|
FileAttachment(byte[] buffer)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(byte[] buffer,
java.lang.String name)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(byte[] buffer,
java.lang.String name,
java.lang.String contentType)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.io.InputStream inputStream)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.io.InputStream inputStream,
java.lang.String fileName)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.io.InputStream inputStream,
java.lang.String name,
java.lang.String contentType)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.lang.String filePath)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.lang.String filePath,
java.lang.String name)
Initializes a new instance of the FileAttachment class.
|
FileAttachment(java.lang.String filePath,
java.lang.String name,
java.lang.String contentType)
Initializes a new instance of the FileAttachment class.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getContent()
Gets the Base64-encoded contents of the file attachment.
|
java.io.InputStream |
getInputStream()
Gets the input stream.
|
boolean |
isContactPhoto()
Gets whether the file attachment is a contact picture.
|
void |
save(java.io.OutputStream outputStream)
Save.
|
void |
save(java.lang.String filePath)
Save.
|
void |
save(java.lang.String filePath,
boolean overwrite)
Save.
|
void |
setContactPhoto(boolean isContactPhoto)
Sets whether the file attachment is a contact picture.
|
void |
setContent(byte[] content)
Sets the Base64-encoded contents of the file attachment.
|
byte[] |
toByteArray()
To byte array.
|
java.lang.String |
toString()
Converts the value of the current FileAttachment object to its equivalent string representation.
|
getAttachmentId, getContentId, getContentLocation, getContentType, getLastModifiedTime, getName, getSize, isInline, setAttachmentId, setContentId, setContentLocation, setContentType, setInline, setLastModifiedTime, setName, setSizepublic FileAttachment()
public FileAttachment(java.lang.String filePath)
throws java.io.IOException
filePath - the file pathjava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(java.lang.String filePath,
java.lang.String name)
throws java.io.IOException
filePath - the file pathname - the namejava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(java.lang.String filePath,
java.lang.String name,
java.lang.String contentType)
throws java.io.IOException
filePath - the file pathname - the namecontentType - the content typejava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - the input streamjava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(java.io.InputStream inputStream,
java.lang.String fileName)
throws java.io.IOException
inputStream - the input streamfileName - the file namejava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(java.io.InputStream inputStream,
java.lang.String name,
java.lang.String contentType)
throws java.io.IOException
inputStream - the input streamname - the namecontentType - the content typejava.io.IOException - Signals that an I/O exception has occurred.public FileAttachment(byte[] buffer)
buffer - the bufferpublic FileAttachment(byte[] buffer,
java.lang.String name)
buffer - the buffername - the namepublic FileAttachment(byte[] buffer,
java.lang.String name,
java.lang.String contentType)
buffer - the buffername - the namecontentType - the content typepublic void save(java.lang.String filePath)
throws java.io.IOException
filePath - the file pathjava.io.IOException - Signals that an I/O exception has occurred.public void save(java.lang.String filePath,
boolean overwrite)
throws java.io.IOException
filePath - the file pathoverwrite - the overwritejava.io.IOException - Signals that an I/O exception has occurred.public void save(java.io.OutputStream outputStream)
throws java.io.IOException
outputStream - the output streamjava.io.IOException - Signals that an I/O exception has occurred.public byte[] toByteArray()
public java.io.InputStream getInputStream()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isContactPhoto()
public void setContactPhoto(boolean isContactPhoto)
isContactPhoto - the new contact photopublic byte[] getContent()
public void setContent(byte[] content)
content - the new content