i2p.susi.webmail

## Class Attachment

- java.lang.Object
- - i2p.susi.webmail.Attachment

-     public class Attachment
      extends Object

  Represents an email attachment with metadata and file data.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Attachment(String name, String type, String encoding, File data)` Creates a new Attachment.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deleteData()` Delete the data file
    `boolean` | `equals(Object o)` Compares this attachment to another for equality.
    `String` | `getContentType()`
    `InputStream` | `getData()`
    `String` | `getFileName()`
    `String` | `getPath()`
    `long` | `getSize()` The unencoded size
    `String` | `getTransferEncoding()`
    `int` | `hashCode()` Returns a hash code based on the file name and data file.

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

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Attachment

          Attachment(String name,
                     String type,
                     String encoding,
                     File data)

      Creates a new Attachment.
      Parameters:
        `name` - the file name
        `type` - the content type
        `encoding` - the transfer encoding, non-null
        `data` - the file containing the attachment data

  - ### Method Detail

    - #### deleteData

          public void deleteData()

      Delete the data file

    - #### equals

          public boolean equals(Object o)

      Compares this attachment to another for equality.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `o` - the object to compare with
      Returns:
        true if the attachments are equal

    - #### getContentType

          public String getContentType()

      Returns:
        the content type

    - #### getData

          public InputStream getData()
                              throws IOException

      Returns:
        an input stream for reading the attachment data
      Throws:
        `IOException` - if the file cannot be opened for reading

    - #### getFileName

          public String getFileName()

      Returns:
        the file name

    - #### getPath

          public String getPath()

      Returns:
        absolute path to the data file

    - #### getSize

          public long getSize()

      The unencoded size

    - #### getTransferEncoding

          public String getTransferEncoding()

      Returns:
        the transfer encoding, non-null

    - #### hashCode

          public int hashCode()

      Returns a hash code based on the file name and data file.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        the hash code