01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/content/tags/sakai_2-4-1/content-api/api/src/java/org/sakaiproject/content/api/ContentResource.java $
03: * $Id: ContentResource.java 13360 2006-08-03 21:35:13Z jimeng@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.content.api;
21:
22: import java.io.InputStream;
23:
24: import org.sakaiproject.content.api.ContentEntity;
25: import org.sakaiproject.content.api.GroupAwareEntity;
26: import org.sakaiproject.exception.ServerOverloadException;
27: import org.sakaiproject.time.api.Time;
28:
29: /**
30: * <p>ContentResource is the core interface for a Resource object in the GenericContentHostingService.</p>
31: */
32: public interface ContentResource extends ContentEntity {
33: /**
34: * Access the content byte length.
35: * @return The content byte length.
36: */
37: public int getContentLength();
38:
39: /**
40: * Access the resource MIME type.
41: * @return The resource MIME type.
42: */
43: public String getContentType();
44:
45: /**
46: * Access an array of the bytes of the resource.
47: * @return An array containing the bytes of the resource's content.
48: * @exception ServerOverloadException
49: * if server is configured to save resource body in filesystem and an error occurs while
50: * trying to access the filesystem.
51: */
52: public byte[] getContent() throws ServerOverloadException;
53:
54: /**
55: * Access the content as a stream.
56: * Please close the stream when done as it may be holding valuable system resources.
57: * @return an InputStream through which the bytes of the resource can be read.
58: * @throws ServerOverloadException if the server cannot produce the content stream at this time.
59: */
60: public InputStream streamContent() throws ServerOverloadException;
61:
62: } // ContentResource
|