blob: 69fe885f350488b7baad2a06cbc0c883fb8c5260 [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 Slee78f58e22006-09-02 04:17:07 +000017 public void writeMessageBegin(TTransport out,
18 TMessage message) throws TException;
19
20 public void writeMessageEnd (TTransport out) throws TException;
21
Mark Slee530fd662006-08-09 00:05:18 +000022 public void writeStructBegin (TTransport out,
23 TStruct struct) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000024
Mark Slee530fd662006-08-09 00:05:18 +000025 public void writeStructEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000026
Mark Slee530fd662006-08-09 00:05:18 +000027 public void writeFieldBegin (TTransport out,
28 TField field) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000029
Mark Slee530fd662006-08-09 00:05:18 +000030 public void writeFieldEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000031
Mark Slee530fd662006-08-09 00:05:18 +000032 public void writeFieldStop (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000033
Mark Slee530fd662006-08-09 00:05:18 +000034 public void writeMapBegin (TTransport out,
35 TMap map) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000036
Mark Slee530fd662006-08-09 00:05:18 +000037 public void writeMapEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000038
Mark Slee530fd662006-08-09 00:05:18 +000039 public void writeListBegin (TTransport out,
40 TList list) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000041
Mark Slee530fd662006-08-09 00:05:18 +000042 public void writeListEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000043
Mark Slee530fd662006-08-09 00:05:18 +000044 public void writeSetBegin (TTransport out,
45 TSet set) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000046
Mark Slee530fd662006-08-09 00:05:18 +000047 public void writeSetEnd (TTransport out) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000048
Mark Slee78f58e22006-09-02 04:17:07 +000049 public void writeBool (TTransport out,
50 boolean b) throws TException;
51
Mark Slee530fd662006-08-09 00:05:18 +000052 public void writeByte (TTransport out,
53 byte b) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000054
Mark Slee78f58e22006-09-02 04:17:07 +000055 public void writeI16 (TTransport out,
56 short i16) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000057
Mark Slee530fd662006-08-09 00:05:18 +000058 public void writeI32 (TTransport out,
59 int i32) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000060
Mark Slee530fd662006-08-09 00:05:18 +000061 public void writeI64 (TTransport out,
62 long i64) throws TException;
63
64 public void writeString (TTransport out,
65 String str) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000066
67 /**
68 * Reading methods.
69 */
70
Mark Slee78f58e22006-09-02 04:17:07 +000071 public TMessage readMessageBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000072
Mark Slee78f58e22006-09-02 04:17:07 +000073 public void readMessageEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000074
Mark Slee78f58e22006-09-02 04:17:07 +000075 public TStruct readStructBegin (TTransport in) throws TException;
76
77 public void readStructEnd (TTransport in) throws TException;
78
79 public TField readFieldBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000080
Mark Slee78f58e22006-09-02 04:17:07 +000081 public void readFieldEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000082
Mark Slee78f58e22006-09-02 04:17:07 +000083 public TMap readMapBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000084
Mark Slee78f58e22006-09-02 04:17:07 +000085 public void readMapEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000086
Mark Slee78f58e22006-09-02 04:17:07 +000087 public TList readListBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000088
Mark Slee78f58e22006-09-02 04:17:07 +000089 public void readListEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000090
Mark Slee78f58e22006-09-02 04:17:07 +000091 public TSet readSetBegin (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000092
Mark Slee78f58e22006-09-02 04:17:07 +000093 public void readSetEnd (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000094
Mark Slee78f58e22006-09-02 04:17:07 +000095 public boolean readBool (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000096
Mark Slee78f58e22006-09-02 04:17:07 +000097 public byte readByte (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +000098
Mark Slee78f58e22006-09-02 04:17:07 +000099 public short readI16 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +0000100
Mark Slee78f58e22006-09-02 04:17:07 +0000101 public int readI32 (TTransport in) throws TException;
102
103 public long readI64 (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +0000104
Mark Slee78f58e22006-09-02 04:17:07 +0000105 public String readString (TTransport in) throws TException;
Mark Slee83c52a82006-06-07 06:51:18 +0000106
107}