Debian Codegraph @

src/java/org/astrogrid/samp/httpd/ServerResource.java

raw
1 package org.astrogrid.samp.httpd;
2
3 import java.io.IOException;
4 import java.io.OutputStream;
5
6 /**
7 * Defines a resource suitable for serving by the {@link ResourceHandler}
8 * HTTP server handler.
9 *
10 * @author Mark Taylor
11 * @since 3 Sep 2008
12 */
13 public interface ServerResource {
14
15 /**
16 * Returns the MIME type of this resource.
17 *
18 * @return value of Content-Type HTTP header
19 */
20 String getContentType();
21
22 /**
23 * Returns the number of bytes in this resource, if known.
24 *
25 * @return value of Content-Length HTTP header if known;
26 * otherwise a negative number
27 */
28 long getContentLength();
29
30 /**
31 * Writes resource body.
32 *
33 * @param out destination stream
34 */
35 void writeBody( OutputStream out ) throws IOException;
36 }