01: // HttpMimeType.java
02: // $Id: HttpMimeType.java,v 1.9 2000/08/16 21:38:00 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1997.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.www.http;
07:
08: import org.w3c.www.mime.MimeType;
09:
10: public class HttpMimeType extends BasicValue {
11: MimeType type = null;
12:
13: /**
14: * parse.
15: * @exception HttpParserException if parsing failed.
16: */
17: protected void parse() throws HttpParserException {
18: String str = new String(raw, 0, 0, raw.length);
19: try {
20: type = new MimeType(str);
21: } catch (Exception ex) {
22: error("Invalid content type.");
23: }
24: }
25:
26: protected void updateByteValue() {
27: String str = type.toString();
28: raw = new byte[str.length()];
29: roff = 0;
30: rlen = raw.length;
31: str.getBytes(0, raw.length, raw, 0);
32: }
33:
34: public Object getValue() {
35: validate();
36: return type;
37: }
38:
39: public HttpMimeType() {
40: super ();
41: }
42:
43: HttpMimeType(boolean isValid, MimeType type) {
44: this.isValid = isValid;
45: this.type = type;
46: }
47: }
|