Package com.independentsoft.email.mime

# Class Attachment

java.lang.Object
com.independentsoft.email.mime.Attachment

public class Attachment extends Object
Class Attachment.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Attachment()`
  Initializes 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 Type
  Method
  Description
  `byte[]`
  `getBytes()`
  Gets the bytes.
  `String`
  `getContentDescription()`
  Gets the content description.
  `ContentDisposition`
  `getContentDisposition()`
  Gets the content disposition.
  `String`
  `getContentID()`
  Gets the content identifier.
  `String`
  `getContentLocation()`
  Gets the content location.
  `ContentType`
  `getContentType()`
  Gets the type of the content.
  `String`
  `getFileName()`
  Gets the name of the file.
  `String`
  `getName()`
  Gets the name.
  `InputStream`
  `getStream()`
  Gets the stream.
  `void`
  `open​(String filePath)`
  Opens the specified file path.
  `void`
  `save​(OutputStream stream)`
  Saves the specified stream.
  `void`
  `save​(String filePath)`
  Saves this attachment to the specified file.
  `void`
  `save​(String filePath, boolean overwrite)`
  Saves this attachment to the specified file.
  `void`
  `setContentDescription​(String contentDescription)`
  Sets the content description.
  `void`
  `setContentDisposition​(ContentDisposition contentDisposition)`
  Sets the content disposition.
  `void`
  `setContentID​(String contentID)`
  Sets the content identifier.
  `void`
  `setContentLocation​(String contentLocation)`
  Sets the content location.
  `void`
  `setContentType​(ContentType contentType)`
  Sets the type of the content.
  `void`
  `setName​(String name)`
  Sets the name.
  `String`
  `toString()`
  Returns a String that represents this instance.

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

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

- ## Constructor Details

  - ### Attachment

    public Attachment()
    Initializes a new instance of the Attachment class.

  - ### Attachment

    public Attachment​(String filePath) throws IOException
    Initializes a new instance of the Attachment class.
    Parameters:
      `filePath` - The file path.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### Attachment

    public Attachment​(InputStream stream) throws IOException
    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

    public Attachment​(InputStream stream, String name) throws IOException
    Initializes a new instance of the Attachment class.
    Parameters:
      `stream` - The stream.
      `name` - The name.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### Attachment

    public Attachment​(byte[] buffer, String name)
    Initializes a new instance of the Attachment class.
    Parameters:
      `buffer` - The buffer.
      `name` - The name.

- ## Method Details

  - ### open

    public void open​(String filePath) throws IOException
    Opens the specified file path.
    Parameters:
      `filePath` - The file path.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### save

    public void save​(OutputStream stream) throws IOException
    Saves the specified stream.
    Parameters:
      `stream` - The stream.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### save

    public void save​(String filePath) throws IOException
    Saves this attachment to the specified file.
    Parameters:
      `filePath` - File path.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### save

    public void save​(String filePath, boolean overwrite) throws IOException
    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

    public InputStream getStream()
    Gets the stream.
    Returns:
      Stream.

  - ### getBytes

    public byte[] getBytes()
    Gets the bytes.
    Returns:
      The bytes.

  - ### getFileName

    public String getFileName()
    Gets the name of the file.
    Returns:
      The file name.

  - ### toString

    public String toString()
    Returns a String that represents this instance.
    Overrides:
      `toString` in class `Object`
    Returns:
      A String that represents this instance.

  - ### getName

    public String getName()
    Gets the name.
    Returns:
      The name.

  - ### setName

    public void setName​(String name)
    Sets the name.
    Parameters:
      `name` - The name.

  - ### getContentType

    public ContentType getContentType()
    Gets the type of the content.
    Returns:
      The type of the content.

  - ### setContentType

    public void setContentType​(ContentType contentType)
    Sets the type of the content.
    Parameters:
      `contentType` - The type of the content.

  - ### getContentID

    public String getContentID()
    Gets the content identifier.
    Returns:
      The content identifier.

  - ### setContentID

    public void setContentID​(String contentID)
    Sets the content identifier.
    Parameters:
      `contentID` - The content identifier.

  - ### getContentLocation

    public String getContentLocation()
    Gets the content location.
    Returns:
      The content location.

  - ### setContentLocation

    public void setContentLocation​(String contentLocation)
    Sets the content location.
    Parameters:
      `contentLocation` - The content location.

  - ### getContentDescription

    public String getContentDescription()
    Gets the content description.
    Returns:
      The content description.

  - ### setContentDescription

    public void setContentDescription​(String contentDescription)
    Sets the content description.
    Parameters:
      `contentDescription` - The content description.

  - ### getContentDisposition

    public ContentDisposition getContentDisposition()
    Gets the content disposition.
    Returns:
      The content disposition.

  - ### setContentDisposition

    public void setContentDisposition​(ContentDisposition contentDisposition)
    Sets the content disposition.
    Parameters:
      `contentDisposition` - The content disposition.