1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.transport.jms;
18
19 import java.io.IOException;
20 import java.io.OutputStream;
21 import javax.jms.BytesMessage;
22 import javax.jms.JMSException;
23
24 import org.springframework.util.Assert;
25
26
27
28
29
30
31
32 class BytesMessageOutputStream extends OutputStream {
33
34 private final BytesMessage message;
35
36 BytesMessageOutputStream(BytesMessage message) {
37 Assert.notNull(message, "'message' must not be null");
38 this.message = message;
39 }
40
41 public void write(byte b[]) throws IOException {
42 try {
43 message.writeBytes(b);
44 }
45 catch (JMSException ex) {
46 throw new JmsTransportException(ex);
47 }
48 }
49
50 public void write(byte b[], int off, int len) throws IOException {
51 try {
52 message.writeBytes(b, off, len);
53 }
54 catch (JMSException ex) {
55 throw new JmsTransportException(ex);
56 }
57 }
58
59 public void write(int b) throws IOException {
60 try {
61 message.writeByte((byte) b);
62 }
63 catch (JMSException ex) {
64 throw new JmsTransportException(ex);
65 }
66 }
67 }