Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community
Interface BinaryBody

All Superinterfaces:
JiveObject

public interface BinaryBody
extends JiveObject

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 StorageManager; the default implementation puts binary body objects in the database.


Method Summary
 String getContentType()
          Returns the content type of the body object.
 InputStream 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.
 String getName()
          Returns the name of the body object.
 long getSize()
          Returns the size of the body object in bytes.
 void setName(String name)
          Sets the name of the body object.
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getID, getObjectType
 

Method Detail

getContentType

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.

getName

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

void setName(String name)
             throws UnauthorizedException
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

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

Returns:
the size of the body object in bytes.

getData

InputStream getData()
                    throws 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:
IOException - if an error occurs reading the body object from storage.

getDownloadCount

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

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

Clearspace Project Page

Copyright © 1999-2007 Jive Software.