com.moyosoft.exchange.attachment
Interface ExchangeFileAttachment

All Superinterfaces:
ExchangeAttachment

public interface ExchangeFileAttachment
extends ExchangeAttachment

Represents a file attached to an Exchange item.


Method Summary
 byte[] getContent()
          Returns the content of the attached file as a bytes array.
 java.io.InputStream getContentAsStream()
          Returns an input stream that can be used to read the content of the attached file.
 void writeTo(java.io.File file)
          Writes the content of the attachment to the specified file.
 void writeTo(java.io.OutputStream stream)
          Writes the content of the attached file to the specified output stream.
 
Methods inherited from interface com.moyosoft.exchange.attachment.ExchangeAttachment
delete, getAttachmentInfo, getContentId, getContentLocation, getContentType, getName, getParentItemId
 

Method Detail

getContent

byte[] getContent()
                  throws ExchangeServiceException
Returns the content of the attached file as a bytes array.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getContentAsStream

java.io.InputStream getContentAsStream()
                                       throws ExchangeServiceException
Returns an input stream that can be used to read the content of the attached file.

This method never returns null even if the file has no content; an empty input stream will be returned in that case.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

writeTo

void writeTo(java.io.OutputStream stream)
             throws ExchangeServiceException,
                    java.io.IOException
Writes the content of the attached file to the specified output stream.

Specified by:
writeTo in interface ExchangeAttachment
Parameters:
stream - the stream to write into.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when writing to the specified stream.

writeTo

void writeTo(java.io.File file)
             throws ExchangeServiceException,
                    java.io.IOException
Writes the content of the attachment to the specified file. If the specified file doesn't exist, it will be created.

Specified by:
writeTo in interface ExchangeAttachment
Parameters:
file - the file to write into.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when writing to the specified file.