microsoft.exchange.webservices.data.property.complex
Class FileAttachment

java.lang.Object
  extended by microsoft.exchange.webservices.data.property.complex.ComplexProperty
      extended by microsoft.exchange.webservices.data.property.complex.Attachment
          extended by microsoft.exchange.webservices.data.property.complex.FileAttachment
All Implemented Interfaces:
ISelfValidate, ComplexFunctionDelegate<EwsServiceXmlReader>

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  InputStream getContentStream()
          Gets the content stream.Gets the name of the file the attachment is linked to.
 String getFileName()
          Gets the name of the file the attachment is linked to.
 String getXmlElementName()
          Gets the name of the XML element.
 boolean isContactPhoto()
          Gets a value indicating whether this attachment is a contact photo.
 void load(OutputStream stream)
          Loads the content of the file attachment into the specified stream.
 void load(String fileName)
          Loads the content of the file attachment into the specified file.
protected  void setContent(byte[] content)
          Sets the content.
protected  void setContentStream(InputStream contentStream)
          Sets the content stream.
protected  void setFileName(String fileName)
          Sets the file name.
 void setIsContactPhoto(boolean isContactPhoto)
          Sets the checks if is contact photo.
 boolean tryReadElementFromXml(EwsServiceXmlReader reader)
          Tries to read element from XML.
 boolean tryReadElementFromXmlToPatch(EwsServiceXmlReader reader)
          For FileAttachment, the only thing need to patch is the AttachmentId.
protected  void validate(int attachmentIndex)
          Validates this instance.
 void writeElementsToXml(EwsServiceXmlWriter writer)
          Writes elements and content to XML.
 
Methods inherited from class microsoft.exchange.webservices.data.property.complex.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.property.complex.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

public String getXmlElementName()
Gets the name of the XML element.

Specified by:
getXmlElementName in class Attachment
Returns:
XML element name

validate

protected void validate(int attachmentIndex)
                 throws ServiceValidationException
Validates this instance.

Parameters:
attachmentIndex - Index of this attachment.
Throws:
ServiceValidationException - the service validation exception

tryReadElementFromXml

public boolean tryReadElementFromXml(EwsServiceXmlReader reader)
                              throws Exception
Tries to read element from XML.

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

tryReadElementFromXmlToPatch

public boolean tryReadElementFromXmlToPatch(EwsServiceXmlReader reader)
                                     throws 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:
Exception

writeElementsToXml

public void writeElementsToXml(EwsServiceXmlWriter writer)
                        throws Exception
Writes elements and content to XML.

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

load

public void load(OutputStream stream)
          throws 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:
Exception - the exception

load

public void load(String fileName)
          throws 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:
Exception - the exception

getFileName

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

Returns:
the file name

setFileName

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

Parameters:
fileName - the new file name

getContentStream

protected 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(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


Copyright © 2012–2015 Microsoft. All rights reserved.