com.moyosoft.exchange.attachment
Interface AttachmentsCollection

All Superinterfaces:
ExchangeCollection<ExchangeAttachment>, java.lang.Iterable<ExchangeAttachment>

public interface AttachmentsCollection
extends ExchangeCollection<ExchangeAttachment>

A collection of attachments attached to an Exchange item. An attachment can be a file (ExchangeFileAttachment) or an Exchange item (ExchangeItemAttachment).

The collection allows to get, iterate over and add new attachments.

This class implements the Iterable interface allowing it to be a target of the foreach statement.


Method Summary
 ExchangeFileAttachment add(byte[] data, AttachmentInfo info)
          Adds a new file attachment with the specified data and parameters to this collection.
 ExchangeFileAttachment add(byte[] data, java.lang.String name)
          Adds a new file attachment with the specified data and parameters to this collection.
 ExchangeItemAttachment add(ExchangeItem item)
          Adds a new attachment referencing the specified item to this collection.
 ExchangeItemAttachment add(ExchangeItem item, AttachmentInfo info)
          Adds a new attachment referencing the specified item to this collection.
 ExchangeItemAttachment add(ExchangeItem item, java.lang.String name)
          Adds a new attachment referencing the specified item to this collection.
 ExchangeFileAttachment add(java.io.File file)
          Reads the content of the specified file and adds the file's data as a new file attachment to this collection.
 ExchangeFileAttachment add(java.io.File file, AttachmentInfo info)
          Reads the content of the specified file and adds the file's data as a new file attachment to this collection.
 ExchangeFileAttachment add(java.io.File file, java.lang.String name)
          Reads the content of the specified file and adds the file's data as a new file attachment to this collection.
 ExchangeFileAttachment add(java.io.InputStream stream, AttachmentInfo info)
          Reads the content of the specified InputStream and adds the read data as a new file attachment to this collection.
 ExchangeFileAttachment add(java.io.InputStream stream, java.lang.String name)
          Reads the content of the specified InputStream and adds the read data as a new file attachment to this collection.
 AttachmentsIterator iterator()
          Returns an iterator over the attachments contained in this collection.
 
Methods inherited from interface com.moyosoft.exchange.util.ExchangeCollection
getAt, getCount
 

Method Detail

iterator

AttachmentsIterator iterator()
Returns an iterator over the attachments contained in this collection. The iterator contains ExchangeAttachment objects.

This method never returns null; an empty iterator is returned if this collection is empty.

Specified by:
iterator in interface java.lang.Iterable<ExchangeAttachment>
See Also:
ExchangeAttachment, ExchangeFileAttachment, ExchangeItemAttachment

add

ExchangeFileAttachment add(byte[] data,
                           AttachmentInfo info)
                           throws ExchangeServiceException
Adds a new file attachment with the specified data and parameters to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
data - the content of the attachment.
info - additional information on the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

add

ExchangeFileAttachment add(byte[] data,
                           java.lang.String name)
                           throws ExchangeServiceException
Adds a new file attachment with the specified data and parameters to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
data - the content of the attachment.
name - the displayed name of the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

add

ExchangeFileAttachment add(java.io.InputStream stream,
                           AttachmentInfo info)
                           throws ExchangeServiceException,
                                  java.io.IOException
Reads the content of the specified InputStream and adds the read data as a new file attachment to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
stream - the input stream containing the attachment's data.
info - additional information on the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the supplied input stream.

add

ExchangeFileAttachment add(java.io.InputStream stream,
                           java.lang.String name)
                           throws ExchangeServiceException,
                                  java.io.IOException
Reads the content of the specified InputStream and adds the read data as a new file attachment to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
stream - the input stream containing the attachment's data.
name - the displayed name of the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the supplied input stream.

add

ExchangeFileAttachment add(java.io.File file,
                           AttachmentInfo info)
                           throws ExchangeServiceException,
                                  java.io.IOException
Reads the content of the specified file and adds the file's data as a new file attachment to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
file - the file to be attached.
info - additional information on the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the specified file.

add

ExchangeFileAttachment add(java.io.File file,
                           java.lang.String name)
                           throws ExchangeServiceException,
                                  java.io.IOException
Reads the content of the specified file and adds the file's data as a new file attachment to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
file - the file to be attached.
name - the displayed name of the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the specified file.

add

ExchangeFileAttachment add(java.io.File file)
                           throws ExchangeServiceException,
                                  java.io.IOException
Reads the content of the specified file and adds the file's data as a new file attachment to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
file - the file to be attached.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when reading the specified file.

add

ExchangeItemAttachment add(ExchangeItem item,
                           AttachmentInfo info)
                           throws ExchangeServiceException
Adds a new attachment referencing the specified item to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
item - the item to be attached.
info - additional information on the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

add

ExchangeItemAttachment add(ExchangeItem item,
                           java.lang.String name)
                           throws ExchangeServiceException
Adds a new attachment referencing the specified item to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
item - the item to be attached.
name - the displayed name of the attachment.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

add

ExchangeItemAttachment add(ExchangeItem item)
                           throws ExchangeServiceException
Adds a new attachment referencing the specified item to this collection. The resulting created attachment is automatically attached to the parent item of this collection.

Parameters:
item - the item to be attached.
Returns:
the created attachment.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.