1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.marshalling;
17
18 import io.netty.buffer.ByteBuf;
19 import org.jboss.marshalling.ByteOutput;
20
21 import java.io.IOException;
22
23
24
25
26
27
28 class ChannelBufferByteOutput implements ByteOutput {
29
30 private final ByteBuf buffer;
31
32
33
34
35 ChannelBufferByteOutput(ByteBuf buffer) {
36 this.buffer = buffer;
37 }
38
39 @Override
40 public void close() throws IOException {
41
42 }
43
44 @Override
45 public void flush() throws IOException {
46
47 }
48
49 @Override
50 public void write(int b) throws IOException {
51 buffer.writeByte(b);
52 }
53
54 @Override
55 public void write(byte[] bytes) throws IOException {
56 buffer.writeBytes(bytes);
57 }
58
59 @Override
60 public void write(byte[] bytes, int srcIndex, int length) throws IOException {
61 buffer.writeBytes(bytes, srcIndex, length);
62 }
63
64
65
66
67
68 ByteBuf getBuffer() {
69 return buffer;
70 }
71 }