1 /** 2 * Copyright (C) 2005-2009 Alfresco Software Limited. 3 * 4 * This file is part of the Spring Surf Extension project. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.springframework.extensions.surf.util; 20 21 import java.io.IOException; 22 import java.io.InputStream; 23 import java.io.Reader; 24 25 26 /** 27 * Content 28 * 29 * @author dcaruana 30 */ 31 public interface Content 32 { 33 /** 34 * Gets content as a string 35 * 36 * @return content as a string 37 * @throws IOException 38 */ 39 public String getContent() throws IOException; 40 41 /** 42 * Gets the content mimetype 43 * 44 * @return mimetype 45 */ 46 public String getMimetype(); 47 48 /** 49 * Gets the content encoding 50 * 51 * @return encoding 52 */ 53 public String getEncoding(); 54 55 /** 56 * Gets the content length (in bytes) 57 * 58 * @return length 59 */ 60 public long getSize(); 61 62 /** 63 * Gets the content input stream 64 * 65 * @return input stream 66 */ 67 public InputStream getInputStream(); 68 69 /** 70 * Gets the content reader (which is sensitive to encoding) 71 * 72 * @return 73 */ 74 public Reader getReader() throws IOException; 75 }