org.sakaiproject.service.legacy.content
Interface ContentResource

All Superinterfaces:
Entity
All Known Subinterfaces:
ContentResourceEdit
All Known Implementing Classes:
BaseContentService.BaseResourceEdit, ContentEntityWrapper

public interface ContentResource
extends Entity

ContentResource is the core interface for a Resource object in the GenericContentHostingService.

Version:
$Revision: 2577 $
Author:
University of Michigan, CHEF Software Development Team
See Also:
org.chefproject.service.generic.GenericContentHostingService, org.chefproject.core.Entity

Field Summary
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Method Summary
 byte[] getContent()
          Access an array of the bytes of the resource.
 int getContentLength()
          Access the content byte length.
 String getContentType()
          Access the resource MIME type.
 InputStream streamContent()
          Access the content as a stream.
 
Methods inherited from interface org.sakaiproject.service.legacy.entity.Entity
getId, getProperties, getReference, getReference, getUrl, getUrl, toXml
 

Method Detail

getContentLength

public int getContentLength()
Access the content byte length.

Returns:
The content byte length.

getContentType

public String getContentType()
Access the resource MIME type.

Returns:
The resource MIME type.

getContent

public byte[] getContent()
                  throws ServerOverloadException
Access an array of the bytes of the resource.

Returns:
An array containing the bytes of the resource's content.
Throws:
ServerOverloadException - if server is configured to save resource body in filesystem and an error occurs while trying to access the filesystem.

streamContent

public InputStream streamContent()
                          throws ServerOverloadException
Access the content as a stream. Please close the stream when done as it may be holding valuable system resources.

Returns:
an InputStream through which the bytes of the resource can be read.
Throws:
ServerOverloadException - if the server cannot produce the content stream at this time.