01: /*
02: * TestInputStreamContext.java
03: *
04: * Created on 26 September 2005, 12:09
05: *
06: * To change this template, choose Tools | Options and locate the template under
07: * the Source Creation and Management node. Right-click the template and choose
08: * Open. You can then make changes to the template in the Source Editor.
09: */
10:
11: package org.objectweb.celtix.bus.bindings;
12:
13: import java.io.ByteArrayInputStream;
14: import java.io.InputStream;
15:
16: import org.objectweb.celtix.context.GenericMessageContext;
17: import org.objectweb.celtix.context.InputStreamMessageContext;
18:
19: /**
20: *
21: * @author apaibir
22: */
23: public class TestInputStreamContext extends GenericMessageContext
24: implements InputStreamMessageContext {
25:
26: private static final long serialVersionUID = 1L;
27: private final byte[] byteArray;
28: private InputStream inputStream;
29:
30: public TestInputStreamContext() {
31: this (null);
32: }
33:
34: public TestInputStreamContext(byte[] bArray) {
35: byteArray = bArray;
36: // put(ObjectMessageContext.MESSAGE_INPUT, false);
37: }
38:
39: public InputStream getInputStream() {
40: if (null != inputStream) {
41: return inputStream;
42: }
43: if (null != byteArray) {
44: return new ByteArrayInputStream(byteArray);
45: }
46: return null;
47: }
48:
49: public void setInputStream(InputStream ins) {
50: inputStream = ins;
51: }
52:
53: public boolean isFault() {
54: return false;
55: }
56:
57: public void setFault(boolean b) {
58: }
59: }
|