1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.webpage;
1819/***20 * A cached resource object, stored in memory to optimize access to static resources21 * such as images and style sheets.22 *23 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>24 * @version $Id: CachedResource.java,v 1.3 2004/02/23 03:46:26 jford Exp $ 25 */2627publicclassCachedResource28 {
29privateint contentType;
30private byte[] content;
3132/***33 * Constructor for a cached resource. 34 *35 * @param contentType The HTTP content type for a cached resource as defined 36 * in WebPageHelper, i.e. WebPageHelper.CT_HTML, WebPageHelper.CT_IMAGE....37 * @param content The byte array of content this cached. This content can be38 * binary images, or static text such as scripts and style sheets.39 * 40 */41publicCachedResource(int contentType, byte[] content)
42 {
43this.contentType = contentType;
44this.content = new byte[content.length];
45 System.arraycopy(content, 0, this.content, 0, this.content.length);
46 }
4748/***49 * Gets the content of this resource in a byte array.50 *51 * @return A byte array of the resource's content.52 */53public byte[] getContent()
54 {
55return content;
56 }
5758/***59 * Accessor to get the content type for this resource as defined in WebPageHelper60 *61 * @return The content type for this resource.62 */63publicint getContentType()
64 {
65return contentType;
66 }
676869 }