KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > output > StreamResult


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under LGPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portal.server.output;
12
13 import org.jboss.portal.server.output.Result;
14 import org.jboss.portal.server.WindowContext;
15
16 /**
17  * Stream a result to the client directly.
18  *
19  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
20  * @version $Revision: 1.1 $
21  */

22 public class StreamResult extends Result
23 {
24
25    private String JavaDoc contentType;
26    private byte[] bytes;
27
28    public StreamResult(WindowContext producer, String JavaDoc contentType, byte[] bytes)
29    {
30       super(producer);
31       if (contentType == null)
32       {
33          throw new IllegalArgumentException JavaDoc("Content type cannot be null");
34       }
35       if (bytes == null)
36       {
37          throw new IllegalArgumentException JavaDoc("Bytes cannot be null");
38       }
39       this.contentType = contentType;
40       this.bytes = bytes;
41    }
42
43    public String JavaDoc getContentType()
44    {
45       return contentType;
46    }
47
48    public byte[] getBytes()
49    {
50       return bytes;
51    }
52 }
53
Popular Tags