Compoze Software, Inc.

com.compoze.exchange.webdav
Class Attachment


java.lang.Object

  |

  +--com.compoze.exchange.webdav.Attachment

All Implemented Interfaces:
java.io.Serializable

public class Attachment
extends java.lang.Object
implements java.io.Serializable

This class wraps around a mail message attachment.

See Also:
Serialized Form

Constructor Summary
Attachment(java.lang.String sName, java.io.InputStream src)
          Constructor.
Attachment(java.lang.String sName, java.io.InputStream src, int iSize)
          Constructor.
 
Method Summary
protected  java.lang.String createFilename(int iIndex)
          Creates the an escaped name for the file attachment.
 boolean equals(java.lang.Object o)
          Compares the specified object with this attachment for equality.
 java.lang.String getExtension()
          Gets the extension of this attachment.
 java.lang.String getHref()
          Gets the absolute URL for this attachment.
 UniqueID getID()
          Getst the id of this attachemnt.
 int getIndex()
          Gets the index of the attachment in the list of attachments on a message.
 java.io.InputStream getInputStream()
          Gets the input stream of this attachment to download from the Exchange server.
 java.lang.String getMimeTag()
          Gets the MIME tage of this attachment.
 java.lang.String getName()
          Gets the filename of this attachment.
 java.lang.String getPath()
          Gets the path of this attachment
 java.lang.String getShortname()
          Gets the short filename (8.3) of this attachment.
 int getSize()
          Gets the size (in bytes) of this attachment.
 void serverDelete()
          Deletes an attachment.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attachment


public Attachment(java.lang.String sName,
                  java.io.InputStream src)
           throws java.io.IOException
Constructor. The data will be read and the stream will close upon completion. It is preferred one of the Attachment constructors which takes a length be used because that can be used as a hint for setting the content length in the request. Using this method, the entire contents of the attachment must first be read locally into memory to determine how big the attachment is, then it must be re-read to send to the server.
Parameters:
sName - the name of file attachment (exclude the path)
src - the source input stream

Attachment


public Attachment(java.lang.String sName,
                  java.io.InputStream src,
                  int iSize)
Constructor. The data will be read and the stream will close upon completion.
Parameters:
sName - the name of file attachment (exclude the path)
src - the source input stream
iSize - the size of the attachment
Method Detail

getHref


public java.lang.String getHref()
Gets the absolute URL for this attachment. The URL is used to reference the attachment in the Exchange Web store.
Returns:
the URL of file attachment

getPath


public java.lang.String getPath()
Gets the path of this attachment
Returns:
the path of the attachment

getID


public UniqueID getID()
Getst the id of this attachemnt.
Returns:
the id of the attachment

getName


public java.lang.String getName()
Gets the filename of this attachment.
Returns:
the name of file attachment

getShortname


public java.lang.String getShortname()
Gets the short filename (8.3) of this attachment.
Returns:
the short filename of file attachment (may return null)

getExtension


public java.lang.String getExtension()
Gets the extension of this attachment.
Returns:
the extension (may return null)

getSize


public int getSize()
Gets the size (in bytes) of this attachment.
Returns:
size of attachment

getIndex


public int getIndex()
Gets the index of the attachment in the list of attachments on a message.
Returns:
the index of the attachment

serverDelete


public void serverDelete()
                  throws ExchangeException
Deletes an attachment. Important: When you delete an attachment, the indexes of attachments with a higher index than this attachment decrement by one. This method automatically updates the local indexes of attachments obtained from the AbstractMessage.serverGetAttachments() method so that you can delete multiple attachments from the collection. However, be aware that external modifications to the attachments collection that occur between the time that AbstractMessage.serverGetAttachments() was originally called and the time that you call this method could make it so that this method deletes an unexpected attachment, because the local copy of the attachment index could be out of sync with the server.

This method does not use pure WebDAV to do its work. It uses an HTTP request to simulate a browser POST with form data that would be made when a user is using OWA.

Throws:
ExchangeException - if an exception occurs while connecting to or interacting with Exchange

getMimeTag


public java.lang.String getMimeTag()
Gets the MIME tage of this attachment.
Returns:
the MIME tag or null if not found

getInputStream


public java.io.InputStream getInputStream()
                                   throws ExchangeException
Gets the input stream of this attachment to download from the Exchange server.
Returns:
the input stream

createFilename


protected java.lang.String createFilename(int iIndex)
Creates the an escaped name for the file attachment.
Parameters:
iIndex - the index to append
Returns:
the name of file attachment
See Also:
AbstractItem.createFilename(int)

toString


public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the object

equals


public boolean equals(java.lang.Object o)
Compares the specified object with this attachment for equality. param o the object to be compared for equality with this attachment.
Overrides:
equals in class java.lang.Object
Returns:
true if the specified object is equal to this attachment.

Compoze Software, Inc.

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