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