KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > projector > value > DateValue


1 package org.apache.slide.projector.value;
2
3 import java.io.ByteArrayInputStream JavaDoc;
4 import java.io.IOException JavaDoc;
5 import java.io.InputStream JavaDoc;
6 import java.util.Date JavaDoc;
7
8 public class DateValue extends ObjectValue {
9     public final static String JavaDoc CONTENT_TYPE = "application/projector-date";
10     
11     public DateValue(Date JavaDoc date) {
12         super(date);
13     }
14
15     public Date JavaDoc getDate() {
16         return (Date JavaDoc)getObject();
17     }
18     
19     public InputStream JavaDoc getInputStream() throws IOException JavaDoc {
20       return new ByteArrayInputStream JavaDoc(((String JavaDoc)getObject()).getBytes("UTF-8"));
21     }
22
23     public String JavaDoc toString() {
24         return String.valueOf(getObject());
25     }
26
27     public String JavaDoc getContentType() {
28         return CONTENT_TYPE;
29     }
30 }
Popular Tags