1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.tcp.protocols; |
8 | |
|
9 | |
import org.mule.api.MuleContext; |
10 | |
import org.mule.api.context.MuleContextAware; |
11 | |
import org.mule.transformer.wire.SerializedMuleMessageWireFormat; |
12 | |
|
13 | |
import java.io.IOException; |
14 | |
import java.io.InputStream; |
15 | |
import java.io.OutputStream; |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 0 | public class MuleMessageLengthProtocol extends LengthProtocol implements MuleContextAware |
24 | |
{ |
25 | |
|
26 | 0 | private final SerializedMuleMessageWireFormat wireFormat = new SerializedMuleMessageWireFormat(); |
27 | 0 | private final MuleMessageWorker messageWorker = new MuleMessageWorker(wireFormat); |
28 | |
|
29 | |
@Override |
30 | |
public Object read(InputStream is) throws IOException |
31 | |
{ |
32 | 0 | return messageWorker.doRead(super.read(is)); |
33 | |
} |
34 | |
|
35 | |
@Override |
36 | |
public void write(OutputStream os, Object unused) throws IOException |
37 | |
{ |
38 | 0 | super.write(os, messageWorker.doWrite()); |
39 | 0 | } |
40 | |
|
41 | |
public void setMuleContext(MuleContext context) |
42 | |
{ |
43 | 0 | wireFormat.setMuleContext(context); |
44 | 0 | } |
45 | |
} |