Oracle Collaboration Suite Discussions Java API Reference
10g (10.1.1)

Part No. B16232-01


oracle.discussions.sdk
Class TdAttachment

java.lang.Object
  extended byoracle.discussions.sdk.TdAttachment


public class TdAttachment
extends java.lang.Object

TdAttachment is a light-weight object representing an attachment in a message.

It holds metadata about an attachment. The metadata includes the attachment name and size.
Also, instead of storing the actual content of the attachment, we store an id that can be passed into TdMessage.getAttachmentById(int) to fetch the attachment.

Sample code snippet illustrating the usage of TdAttachment.

 //Get the list of attachments.
 List lstOfAttachments = tdbi.getAttachments();
 //if the list is not null, process attachments sizes.
 if (lstOfAttachments != null && lstOfAttachments.size() > 0)
 {
  for (int i=0;i<lstOfAttachments.size();i++)
  {
    //Extract each individual attachment.   
    TdAttachment tda = (TdAttachment)lstOfAttachments.get(i);
    int iBytes += tda.getAttachmentSize();
    int size = tda.getAttachmentFilename().length() + tda.getAttachmentId().length() + 4; // we add 4 for the size(int)
    }
  }
 
Since:
OCS 10.1.1

Constructor Summary
TdAttachment(java.lang.String path_to_attachment, java.lang.String filename, int size)
Constructor to initiliaze an attachment.

Method Summary
java.lang.String getAttachmentFilename()
Returns the attachment filename associated with this attachment.
java.lang.String getAttachmentId()
Returns an attachment id associated with this attachment.
int getAttachmentSize()
Returns the attachment size associated with this attachment.

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

TdAttachment

public TdAttachment(java.lang.String path_to_attachment,
                    java.lang.String filename,
                    int size)
Constructor to initiliaze an attachment.
Parameters:
path_to_attachment - the absolute path to the attachment file
filename - the name of the attachment file
size - size in bytes of teh attachment file.

Method Detail

getAttachmentId

public java.lang.String getAttachmentId()
Returns an attachment id associated with this attachment.

This value can be passed into TdMessage.getAttachmentById to fetch the actual Part that contains the content of this attachment.

Returns:
String string representing attachment id.

getAttachmentFilename

public java.lang.String getAttachmentFilename()
Returns the attachment filename associated with this attachment.

getAttachmentSize

public int getAttachmentSize()
Returns the attachment size associated with this attachment.

Copyright © 2005, Oracle. All rights reserved.