01: // HeaderValue.java
02: // $Id: HeaderValue.java,v 1.3 2000/08/16 21:37:58 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.www.http;
07:
08: import java.io.IOException;
09: import java.io.OutputStream;
10:
11: public interface HeaderValue {
12:
13: /**
14: * Emit this header value to the given output stream.
15: * @param out The output stream to emit this value to.
16: * @exception IOException If some IO error occurs while emiting the value.
17: */
18:
19: public void emit(OutputStream out) throws IOException;
20:
21: /**
22: * Add these bytes to the header raw value.
23: * @param value The raw header value as a byte array.
24: * @param off The beginning of the raw value in the above byte buffer.
25: * @param len The length of the raw value in the above byte buffer.
26: */
27:
28: public void addBytes(byte value[], int off, int len);
29:
30: /**
31: * Reset the header byte value to the given byte array.
32: * @param value The raw header value as a byte array.
33: * @param off The beginning of the raw value in the above byte buffer.
34: * @param len The length of the raw value in the above byte buffer.
35: */
36:
37: public void setBytes(byte value[], int off, int len);
38:
39: /**
40: * Get this header parsed value, in its native type.
41: * HeaderValue implementors can be used as wrappers for the actual
42: * parsed header value. In such case this method should return the wrapped
43: * value (you would otherwise, probably want to return
44: * <strong>this</strong>).
45: */
46:
47: public Object getValue();
48:
49: /**
50: * Return the HTTP encoding for this header value.
51: * This method is slow, and defeats nearly all the over-engeneered
52: * optimization of the HTTP parser.
53: * @return A String representing the header value in a format compatible
54: * with HTTP.
55: */
56:
57: public String toExternalForm();
58:
59: /**
60: * Append this header byte value to the given buffer.
61: * @param buf The buffer to append the byte value to.
62: */
63:
64: public void appendValue(HttpBuffer buf);
65:
66: }
|