KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > bindings > TestInputStreamContext


1 /*
2  * TestInputStreamContext.java
3  *
4  * Created on 26 September 2005, 12:09
5  *
6  * To change this template, choose Tools | Options and locate the template under
7  * the Source Creation and Management node. Right-click the template and choose
8  * Open. You can then make changes to the template in the Source Editor.
9  */

10
11 package org.objectweb.celtix.bus.bindings;
12
13 import java.io.ByteArrayInputStream JavaDoc;
14 import java.io.InputStream JavaDoc;
15
16 import org.objectweb.celtix.context.GenericMessageContext;
17 import org.objectweb.celtix.context.InputStreamMessageContext;
18
19
20 /**
21  *
22  * @author apaibir
23  */

24 public class TestInputStreamContext
25     extends GenericMessageContext
26     implements InputStreamMessageContext {
27
28     private static final long serialVersionUID = 1L;
29     private final byte[] byteArray;
30     private InputStream JavaDoc inputStream;
31     
32     public TestInputStreamContext() {
33         this(null);
34     }
35     
36     public TestInputStreamContext(byte[] bArray) {
37         byteArray = bArray;
38         // put(ObjectMessageContext.MESSAGE_INPUT, false);
39
}
40
41     public InputStream JavaDoc getInputStream() {
42         if (null != inputStream) {
43             return inputStream;
44         }
45         if (null != byteArray) {
46             return new ByteArrayInputStream JavaDoc(byteArray);
47         }
48         return null;
49     }
50
51     public void setInputStream(InputStream JavaDoc ins) {
52         inputStream = ins;
53     }
54
55     public boolean isFault() {
56         return false;
57     }
58
59     public void setFault(boolean b) {
60     }
61 }
62
Popular Tags