microsoft.exchange.webservices.data
Class FileAttachment

java.lang.Object
  extended by microsoft.exchange.webservices.data.ComplexProperty
      extended by microsoft.exchange.webservices.data.Attachment
          extended by microsoft.exchange.webservices.data.FileAttachment

public final class FileAttachment
extends Attachment

Represents a file attachment.


Constructor Summary
protected FileAttachment(Item owner)
          * Initializes a new instance.
 
Method Summary
 byte[] getContent()
          * Gets the content of the attachment into memory.
protected  java.io.InputStream getContentStream()
          Gets the content stream.Gets the name of the file the attachment is linked to.
 java.lang.String getFileName()
          * Gets the name of the file the attachment is linked to.
protected  java.lang.String getXmlElementName()
          Gets the name of the XML element.
 boolean isContactPhoto()
          Gets a value indicating whether this attachment is a contact photo.
 void load(java.io.OutputStream stream)
          * Loads the content of the file attachment into the specified stream.
 void load(java.lang.String fileName)
          * Loads the content of the file attachment into the specified file.
protected  void setContent(byte[] content)
          Sets the content.
protected  void setContentStream(java.io.InputStream contentStream)
          Sets the content stream.
protected  void setFileName(java.lang.String fileName)
          Sets the file name.
 void setIsContactPhoto(boolean isContactPhoto)
          Sets the checks if is contact photo.
protected  boolean tryReadElementFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
          * Tries to read element from XML.
protected  boolean tryReadElementFromXmlToPatch(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
          For FileAttachment, the only thing need to patch is the AttachmentId.
protected  void writeElementsToXml(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
          * Writes elements and content to XML.
 
Methods inherited from class microsoft.exchange.webservices.data.Attachment
canSetFieldValue, getContentId, getContentLocation, getContentType, getId, getIsInline, getLastModifiedTime, getName, getOwner, getSize, internalLoad, isNew, load, setContentId, setContentLocation, setContentType, setIsInline, setName, throwIfThisIsNotNew
 
Methods inherited from class microsoft.exchange.webservices.data.ComplexProperty
addOnChangeEvent, changed, clearChangeEvents, clearChangeLog, func, getNamespace, internalValidate, loadFromXml, loadFromXml, readAttributesFromXml, readTextValueFromXml, removeChangeEvent, setNamespace, updateFromXml, updateFromXml, validate, writeAttributesToXml, writeToXml, writeToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileAttachment

protected FileAttachment(Item owner)
* Initializes a new instance.

Parameters:
owner - the owner
Method Detail

getXmlElementName

protected java.lang.String getXmlElementName()
Gets the name of the XML element.

Returns:
XML element name

tryReadElementFromXml

protected boolean tryReadElementFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
                                 throws java.lang.Exception
* Tries to read element from XML.

Overrides:
tryReadElementFromXml in class Attachment
Parameters:
reader - the reader
Returns:
True if element was read.
Throws:
java.lang.Exception - the exception

tryReadElementFromXmlToPatch

protected boolean tryReadElementFromXmlToPatch(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
                                        throws java.lang.Exception
For FileAttachment, the only thing need to patch is the AttachmentId.

Overrides:
tryReadElementFromXmlToPatch in class ComplexProperty
Parameters:
reader - The reader.
Returns:
true if element was read
Throws:
java.lang.Exception

writeElementsToXml

protected void writeElementsToXml(microsoft.exchange.webservices.data.EwsServiceXmlWriter writer)
                           throws java.lang.Exception
* Writes elements and content to XML.

Overrides:
writeElementsToXml in class Attachment
Parameters:
writer - the writer
Throws:
java.lang.Exception - the exception

load

public void load(java.io.OutputStream stream)
          throws java.lang.Exception
* Loads the content of the file attachment into the specified stream. Calling this method results in a call to EWS.

Parameters:
stream - the stream
Throws:
java.lang.Exception - the exception

load

public void load(java.lang.String fileName)
          throws java.lang.Exception
* Loads the content of the file attachment into the specified file. Calling this method results in a call to EWS.

Parameters:
fileName - the file name
Throws:
java.lang.Exception - the exception

getFileName

public java.lang.String getFileName()
* Gets the name of the file the attachment is linked to.

Returns:
the file name

setFileName

protected void setFileName(java.lang.String fileName)
Sets the file name.

Parameters:
fileName - the new file name

getContentStream

protected java.io.InputStream getContentStream()
Gets the content stream.Gets the name of the file the attachment is linked to.

Returns:
The content stream

setContentStream

protected void setContentStream(java.io.InputStream contentStream)
Sets the content stream.

Parameters:
contentStream - the new content stream

getContent

public byte[] getContent()
* Gets the content of the attachment into memory. Content is set only when Load() is called.

Returns:
the content

setContent

protected void setContent(byte[] content)
Sets the content.

Parameters:
content - the new content

isContactPhoto

public boolean isContactPhoto()
                       throws ServiceVersionException
Gets a value indicating whether this attachment is a contact photo.

Returns:
true, if is contact photo
Throws:
ServiceVersionException - the service version exception

setIsContactPhoto

public void setIsContactPhoto(boolean isContactPhoto)
                       throws ServiceVersionException
Sets the checks if is contact photo.

Parameters:
isContactPhoto - the new checks if is contact photo
Throws:
ServiceVersionException - the service version exception