com.independentsoft.exchange

## Class FileAttachment

- java.lang.Object
- - com.independentsoft.exchange.Attachment
  - - com.independentsoft.exchange.FileAttachment

-     public class FileAttachment
      extends Attachment

  Represents a file that is attached to an item in the Exchange store.

- - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class com.independentsoft.exchange.Attachment

      `getAttachmentId, getContentId, getContentLocation, getContentType, getLastModifiedTime, getName, getSize, isInline, setAttachmentId, setContentId, setContentLocation, setContentType, setInline, setLastModifiedTime, setName, setSize`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FileAttachment

          public FileAttachment()

      Initializes a new instance of the FileAttachment class.

    - #### FileAttachment

          public FileAttachment(java.lang.String filePath)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `filePath` - the file path
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(java.lang.String filePath,
                                java.lang.String name)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `filePath` - the file path
        `name` - the name
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(java.lang.String filePath,
                                java.lang.String name,
                                java.lang.String contentType)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `filePath` - the file path
        `name` - the name
        `contentType` - the content type
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(java.io.InputStream inputStream)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `inputStream` - the input stream
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(java.io.InputStream inputStream,
                                java.lang.String fileName)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `inputStream` - the input stream
        `fileName` - the file name
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(java.io.InputStream inputStream,
                                java.lang.String name,
                                java.lang.String contentType)
                         throws java.io.IOException

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `inputStream` - the input stream
        `name` - the name
        `contentType` - the content type
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### FileAttachment

          public FileAttachment(byte[] buffer)

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `buffer` - the buffer

    - #### FileAttachment

          public FileAttachment(byte[] buffer,
                                java.lang.String name)

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `buffer` - the buffer
        `name` - the name

    - #### FileAttachment

          public FileAttachment(byte[] buffer,
                                java.lang.String name,
                                java.lang.String contentType)

      Initializes a new instance of the FileAttachment class.
      Parameters:
        `buffer` - the buffer
        `name` - the name
        `contentType` - the content type

  - ### Method Detail

    - #### save

          public void save(java.lang.String filePath)
                    throws java.io.IOException

      Save.
      Parameters:
        `filePath` - the file path
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### save

          public void save(java.lang.String filePath,
                           boolean overwrite)
                    throws java.io.IOException

      Save.
      Parameters:
        `filePath` - the file path
        `overwrite` - the overwrite
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### save

          public void save(java.io.OutputStream outputStream)
                    throws java.io.IOException

      Save.
      Parameters:
        `outputStream` - the output stream
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### toByteArray

          public byte[] toByteArray()

      To byte array.
      Returns:
        the byte[]

    - #### getInputStream

          public java.io.InputStream getInputStream()

      Gets the input stream.
      Returns:
        the input stream

    - #### toString

          public java.lang.String toString()

      Converts the value of the current FileAttachment object to its equivalent string representation.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string

    - #### isContactPhoto

          public boolean isContactPhoto()

      Gets whether the file attachment is a contact picture.
      Returns:
        true, if is contact photo

    - #### setContactPhoto

          public void setContactPhoto(boolean isContactPhoto)

      Sets whether the file attachment is a contact picture.
      Parameters:
        `isContactPhoto` - the new contact photo

    - #### getContent

          public byte[] getContent()

      Gets the Base64-encoded contents of the file attachment.
      Returns:
        the content

    - #### setContent

          public void setContent(byte[] content)

      Sets the Base64-encoded contents of the file attachment.
      Parameters:
        `content` - the new content