Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.mail
Class FileAttachment

    java.lang.Object
      |
      +--com.compoze.mail.FileAttachment

All Implemented Interfaces:
  IAttachment, java.io.Serializable

public class FileAttachment
extends java.lang.Object
implements java.io.Serializable, IAttachment

This class represents a file attachment. It encapsulates a file name, binary data and the content-type of the data.

See Also:
  Serialized Form

Constructor Summary
`FileAttachment()` Constructor.
`FileAttachment(java.lang.String sName, byte[] data)` Constructor.
`FileAttachment(java.lang.String sName, byte[] data, int iIndex)` Constructor.

Method Summary
`byte[]` | `getBytes()` Gets the binary data (bytes) of the file attachment.
`java.lang.String` | `getContentType()` Gets the content-type of the file attachment.
`java.lang.String` | `getFilename()` Gets the name of the file attachment.
`java.lang.String` | `getName()` Gets the name of this attachment or `null` if not set.
`int` | `getSize()` Gets the size of the attachment (in bytes).
`java.lang.String` | `getSizeKilos()` Gets the size of this attachment (in kilobytes).
`void` | `setBytes(byte[] data)` Sets the binary data (bytes) of the file attachment.
`void` | `setContentType(java.lang.String sContentType)` Sets the content-type for the file attachment.
`void` | `setFilename(java.lang.String sName)` Sets the name of the file attachment.
`void` | `setSize(int iSize)` Sets the size of this attachment.
`java.lang.String` | `toString()` Returns the string representation of this object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FileAttachment

    public FileAttachment()

  Constructor. If using this constructor, the data and filename need to be set individually.

### FileAttachment

    public FileAttachment(java.lang.String sName,
                          byte[] data)

  Constructor. This is a convenience constructor that provides both a filename and the bytes of the file.
  Parameters:
    `sName` - the name of the file attachment
    `data` - the data

### FileAttachment

    public FileAttachment(java.lang.String sName,
                          byte[] data,
                          int iIndex)

  Constructor. This is a convenience constructor that provides both a filename and the bytes of the file.
  Parameters:
    `sName` - the name of the file attachment
    `data` - the data
    `iIndex` - the index of the file attachment

Method Detail

### setFilename

    public void setFilename(java.lang.String sName)

  Sets the name of the file attachment.
  Parameters:
    `sName` - the name of the file attachment

### getFilename

    public java.lang.String getFilename()

  Gets the name of the file attachment.
  Returns:
    the name of the file attachment

### setBytes

    public void setBytes(byte[] data)

  Sets the binary data (bytes) of the file attachment.
  Parameters:
    `data` - the data

### getBytes

    public byte[] getBytes()

  Gets the binary data (bytes) of the file attachment.
  Specified by:
    `getBytes` in interface `IAttachment`
  Returns:
    the data

### getContentType

    public java.lang.String getContentType()

  Gets the content-type of the file attachment.
  Specified by:
    `getContentType` in interface `IAttachment`
  Returns:
    the content-type

### setContentType

    public void setContentType(java.lang.String sContentType)

  Sets the content-type for the file attachment.
  Parameters:
    `sContentType` - the content-type

### getSize

    public int getSize()

  Description copied from interface: `IAttachment`
  Gets the size of the attachment (in bytes).
  Specified by:
    `getSize` in interface `IAttachment`
  Following copied from interface: `com.compoze.mail.IAttachment`
  Returns:
    the size of the attachment (in bytes) or -1 if the size cannot be determined

### setSize

    public void setSize(int iSize)

  Sets the size of this attachment.
  Parameters:
    `iSize` - the size of the attachment (in bytes)

### getSizeKilos

    public java.lang.String getSizeKilos()
                                  throws MailException

  Description copied from interface: `IAttachment`
  Gets the size of this attachment (in kilobytes).
  Specified by:
    `getSizeKilos` in interface `IAttachment`
  Following copied from interface: `com.compoze.mail.IAttachment`
  Returns:
    the size of this attachment (in kilobytes) or empty if the size cannot be determined

### getName

    public java.lang.String getName()

  Description copied from interface: `IAttachment`
  Gets the name of this attachment or `null` if not set.
  Specified by:
    `getName` in interface `IAttachment`
  Following copied from interface: `com.compoze.mail.IAttachment`
  Returns:
    the name or `null` if not set

### toString

    public java.lang.String toString()

  Returns the string representation of this object.
  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.