1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.monitor;
14
15 import java.io.ByteArrayInputStream;
16 import java.io.IOException;
17 import java.io.InputStream;
18 import java.io.OutputStream;
19
20 import javax.activation.DataSource;
21
22 import com.eviware.soapui.SoapUI;
23 import com.eviware.soapui.support.Tools;
24
25 /***
26 * DataSource for a MockRequest
27 *
28 * @author ole.matzura
29 */
30
31 public class MonitorMessageExchangeDataSource implements DataSource
32 {
33 private byte[] data;
34 private String contentType;
35 private String name;
36
37 public MonitorMessageExchangeDataSource(String name, InputStream in, String contentType )
38 {
39 try
40 {
41 data = Tools.readAll( in, 0 ).toByteArray();
42 this.contentType = contentType;
43 this.name = name;
44 }
45 catch (Exception e)
46 {
47 SoapUI.logError( e );
48 }
49 }
50
51 public String getContentType()
52 {
53 return contentType;
54 }
55
56 public InputStream getInputStream() throws IOException
57 {
58 return new ByteArrayInputStream( data );
59 }
60
61 public String getName()
62 {
63 return name;
64 }
65
66 public OutputStream getOutputStream() throws IOException
67 {
68 return null;
69 }
70 }