]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /// Licensed to the Apache Software Foundation (ASF) under one |
2 | /// or more contributor license agreements. See the NOTICE file | |
3 | /// distributed with this work for additional information | |
4 | /// regarding copyright ownership. The ASF licenses this file | |
5 | /// to you under the Apache License, Version 2.0 (the | |
6 | /// "License"); you may not use this file except in compliance | |
7 | /// with the License. You may obtain a copy of the License at | |
8 | /// | |
9 | /// http://www.apache.org/licenses/LICENSE-2.0 | |
10 | /// | |
11 | /// Unless required by applicable law or agreed to in writing, | |
12 | /// software distributed under the License is distributed on an | |
13 | /// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | /// KIND, either express or implied. See the License for the | |
15 | /// specific language governing permissions and limitations | |
16 | /// under the License. | |
17 | ||
18 | part of thrift; | |
19 | ||
20 | /// Forward all operations to the wrapped protocol. Used as a base class. | |
21 | /// | |
22 | /// Adapted from the C# version. | |
23 | class TProtocolDecorator extends TProtocol { | |
24 | final TProtocol _protocol; | |
25 | ||
26 | TProtocolDecorator(TProtocol protocol) | |
27 | : _protocol = protocol, | |
28 | super(protocol.transport); | |
29 | ||
30 | /// Write | |
31 | ||
32 | void writeMessageBegin(TMessage message) { | |
33 | _protocol.writeMessageBegin(message); | |
34 | } | |
35 | ||
36 | void writeMessageEnd() { | |
37 | _protocol.writeMessageEnd(); | |
38 | } | |
39 | ||
40 | void writeStructBegin(TStruct struct) { | |
41 | _protocol.writeStructBegin(struct); | |
42 | } | |
43 | ||
44 | void writeStructEnd() { | |
45 | _protocol.writeStructEnd(); | |
46 | } | |
47 | ||
48 | void writeFieldBegin(TField field) { | |
49 | _protocol.writeFieldBegin(field); | |
50 | } | |
51 | ||
52 | void writeFieldEnd() { | |
53 | _protocol.writeFieldEnd(); | |
54 | } | |
55 | ||
56 | void writeFieldStop() { | |
57 | _protocol.writeFieldStop(); | |
58 | } | |
59 | ||
60 | void writeMapBegin(TMap map) { | |
61 | _protocol.writeMapBegin(map); | |
62 | } | |
63 | ||
64 | void writeMapEnd() { | |
65 | _protocol.writeMapEnd(); | |
66 | } | |
67 | ||
68 | void writeListBegin(TList list) { | |
69 | _protocol.writeListBegin(list); | |
70 | } | |
71 | ||
72 | void writeListEnd() { | |
73 | _protocol.writeListEnd(); | |
74 | } | |
75 | ||
76 | void writeSetBegin(TSet set) { | |
77 | _protocol.writeSetBegin(set); | |
78 | } | |
79 | ||
80 | void writeSetEnd() { | |
81 | _protocol.writeSetEnd(); | |
82 | } | |
83 | ||
84 | void writeBool(bool b) { | |
85 | _protocol.writeBool(b); | |
86 | } | |
87 | ||
88 | void writeByte(int b) { | |
89 | _protocol.writeByte(b); | |
90 | } | |
91 | ||
92 | void writeI16(int i16) { | |
93 | _protocol.writeI16(i16); | |
94 | } | |
95 | ||
96 | void writeI32(int i32) { | |
97 | _protocol.writeI32(i32); | |
98 | } | |
99 | ||
100 | void writeI64(int i64) { | |
101 | _protocol.writeI64(i64); | |
102 | } | |
103 | ||
104 | void writeDouble(double d) { | |
105 | _protocol.writeDouble(d); | |
106 | } | |
107 | ||
108 | void writeString(String str) { | |
109 | _protocol.writeString(str); | |
110 | } | |
111 | ||
112 | void writeBinary(Uint8List bytes) { | |
113 | _protocol.writeBinary(bytes); | |
114 | } | |
115 | ||
116 | /// Read | |
117 | TMessage readMessageBegin() => _protocol.readMessageBegin(); | |
118 | void readMessageEnd() => _protocol.readMessageEnd(); | |
119 | ||
120 | TStruct readStructBegin() => _protocol.readStructBegin(); | |
121 | void readStructEnd() => _protocol.readStructEnd(); | |
122 | ||
123 | TField readFieldBegin() => _protocol.readFieldBegin(); | |
124 | void readFieldEnd() => _protocol.readFieldEnd(); | |
125 | ||
126 | TMap readMapBegin() => _protocol.readMapBegin(); | |
127 | void readMapEnd() => _protocol.readMapEnd(); | |
128 | ||
129 | TList readListBegin() => _protocol.readListBegin(); | |
130 | void readListEnd() => _protocol.readListEnd(); | |
131 | ||
132 | TSet readSetBegin() => _protocol.readSetBegin(); | |
133 | void readSetEnd() => _protocol.readSetEnd(); | |
134 | ||
135 | bool readBool() => _protocol.readBool(); | |
136 | ||
137 | int readByte() => _protocol.readByte(); | |
138 | ||
139 | int readI16() => _protocol.readI16(); | |
140 | ||
141 | int readI32() => _protocol.readI32(); | |
142 | ||
143 | int readI64() => _protocol.readI64(); | |
144 | ||
145 | double readDouble() => _protocol.readDouble(); | |
146 | ||
147 | String readString() => _protocol.readString(); | |
148 | ||
149 | Uint8List readBinary() => _protocol.readBinary(); | |
150 | } |