blob: a60becbd0419b97b53c16a0c11cafec9841338de [file] [log] [blame]
Mark Slee83c52a82006-06-07 06:51:18 +00001package com.facebook.thrift.protocol;
2
Mark Slee83c52a82006-06-07 06:51:18 +00003import com.facebook.thrift.TException;
4import com.facebook.thrift.transport.TTransport;
5
6/**
7 * Protocol interface definition.
8 *
9 * @author Mark Slee <mcslee@facebook.com>
10 */
11public interface TProtocol {
12
13 /**
14 * Writing methods.
15 */
16
Mark Slee530fd662006-08-09 00:05:18 +000017 public void writeStructBegin (TTransport out,
18 TStruct struct) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000019
Mark Slee530fd662006-08-09 00:05:18 +000020 public void writeStructEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000021
Mark Slee530fd662006-08-09 00:05:18 +000022 public void writeFieldBegin (TTransport out,
23 TField field) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000024
Mark Slee530fd662006-08-09 00:05:18 +000025 public void writeFieldEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000026
Mark Slee530fd662006-08-09 00:05:18 +000027 public void writeFieldStop (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000028
Mark Slee530fd662006-08-09 00:05:18 +000029 public void writeMapBegin (TTransport out,
30 TMap map) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000031
Mark Slee530fd662006-08-09 00:05:18 +000032 public void writeMapEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000033
Mark Slee530fd662006-08-09 00:05:18 +000034 public void writeListBegin (TTransport out,
35 TList list) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000036
Mark Slee530fd662006-08-09 00:05:18 +000037 public void writeListEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000038
Mark Slee530fd662006-08-09 00:05:18 +000039 public void writeSetBegin (TTransport out,
40 TSet set) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000041
Mark Slee530fd662006-08-09 00:05:18 +000042 public void writeSetEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000043
Mark Slee530fd662006-08-09 00:05:18 +000044 public void writeByte (TTransport out,
45 byte b) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000046
Mark Slee530fd662006-08-09 00:05:18 +000047 public void writeU32 (TTransport out,
48 int u32) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000049
Mark Slee530fd662006-08-09 00:05:18 +000050 public void writeI32 (TTransport out,
51 int i32) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000052
Mark Slee530fd662006-08-09 00:05:18 +000053 public void writeU64 (TTransport out,
54 long u64) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000055
Mark Slee530fd662006-08-09 00:05:18 +000056 public void writeI64 (TTransport out,
57 long i64) throws TException;
58
59 public void writeString (TTransport out,
60 String str) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000061
62 /**
63 * Reading methods.
64 */
65
Mark Slee530fd662006-08-09 00:05:18 +000066 public TStruct readStructBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000067
Mark Slee530fd662006-08-09 00:05:18 +000068 public void readStructEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000069
Mark Slee530fd662006-08-09 00:05:18 +000070 public TField readFieldBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000071
Mark Slee530fd662006-08-09 00:05:18 +000072 public void readFieldEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000073
Mark Slee530fd662006-08-09 00:05:18 +000074 public TMap readMapBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000075
Mark Slee530fd662006-08-09 00:05:18 +000076 public void readMapEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000077
Mark Slee530fd662006-08-09 00:05:18 +000078 public TList readListBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000079
Mark Slee530fd662006-08-09 00:05:18 +000080 public void readListEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000081
Mark Slee530fd662006-08-09 00:05:18 +000082 public TSet readSetBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000083
Mark Slee530fd662006-08-09 00:05:18 +000084 public void readSetEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000085
Mark Slee530fd662006-08-09 00:05:18 +000086 public byte readByte (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000087
Mark Slee530fd662006-08-09 00:05:18 +000088 public int readU32 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000089
Mark Slee530fd662006-08-09 00:05:18 +000090 public int readI32 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000091
Mark Slee530fd662006-08-09 00:05:18 +000092 public long readU64 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000093
Mark Slee530fd662006-08-09 00:05:18 +000094 public long readI64 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000095
Mark Slee530fd662006-08-09 00:05:18 +000096 public String readString (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000097
98}