Clearspace API (2.0.15) Web Services Client Javadocs

com.jivesoftware.community.webservices
Class WSBinaryBody

java.lang.Object
  extended by com.jivesoftware.community.webservices.WSJiveObject
      extended by com.jivesoftware.community.webservices.WSBinaryBody

public class WSBinaryBody
extends WSJiveObject

An object that encapsulates a binary document body. Each binary body object has a unique ID and is made up of three parts: binary data (read and written using an InputStream), a name, and content type. A binary body might have a name "technote.pfg" and corresponding content type of "application/pdf". A full listing of possible content types can be found at: ftp://ftp.iana.org/in-notes/iana/assignments/media-types/ The storage mechanism of binary body objects is controlled via the com.jivesoftware.community.StorageManager; the default implementation puts binary body objects in the database.


Field Summary
 
Fields inherited from class com.jivesoftware.community.webservices.WSJiveObject
id, objectType
 
Constructor Summary
WSBinaryBody()
           
 
Method Summary
 java.lang.String getContentType()
          Returns the content type of the body object.
 byte[] getData()
          Returns a InputStream for the binary contents of the body object.
 int getDownloadCount()
          Returns the number of times the binary body has been downloaded.
 java.lang.String getName()
          Returns the name of the body object.
 long getSize()
          Returns the size of the body object in bytes.
 void setContentType(java.lang.String contentType)
           
 void setData(byte[] data)
           
 void setDownloadCount(int downloadCount)
           
 void setName(java.lang.String name)
          Sets the name of the body object.
 void setSize(long size)
           
 
Methods inherited from class com.jivesoftware.community.webservices.WSJiveObject
equals, getID, getObjectType, hashCode, setID, setObjectType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WSBinaryBody

public WSBinaryBody()
Method Detail

getContentType

public java.lang.String getContentType()
Returns the content type of the body object. For example, the content type of an pdf body object might be "application/pdf".

Returns:
the body object content type.

setContentType

public void setContentType(java.lang.String contentType)

getName

public java.lang.String getName()
Returns the name of the body object. Most often, the body object name is the original name of the file that created the body object, such as "technote.pdf"

Returns:
the name of the body object.

setName

public void setName(java.lang.String name)
Sets the name of the body object. Most often, the body object name is the original name of the file that created the body object, such as "technote.pdf"

Parameters:
name - the new name of the body object.
Throws:
UnauthorizedException - if not allowed to modify the body object

getSize

public long getSize()
Returns the size of the body object in bytes.

Returns:
the size of the body object in bytes.

setSize

public void setSize(long size)

getData

public byte[] getData()
               throws java.io.IOException
Returns a InputStream for the binary contents of the body object. The stream should be closed after reading the body object is completed. The InputStream will already be buffered, so there is no advantage to using additional buffering.

Returns:
the binary contents of the body object.
Throws:
java.io.IOException - if an error occurs reading the body object from storage.

setData

public void setData(byte[] data)

getDownloadCount

public int getDownloadCount()
Returns the number of times the binary body has been downloaded.

Returns:
the number of times the binary body has been downloaded.

setDownloadCount

public void setDownloadCount(int downloadCount)

Clearspace Project Page

Copyright © 1999-2007 Jive Software.