Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 1 | package com.facebook.thrift.protocol; |
| 2 | |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 3 | import com.facebook.thrift.TException; |
| 4 | import com.facebook.thrift.transport.TTransport; |
| 5 | |
| 6 | /** |
| 7 | * Protocol interface definition. |
| 8 | * |
| 9 | * @author Mark Slee <mcslee@facebook.com> |
| 10 | */ |
| 11 | public interface TProtocol { |
| 12 | |
| 13 | /** |
| 14 | * Writing methods. |
| 15 | */ |
| 16 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 17 | public void writeStructBegin (TTransport out, |
| 18 | TStruct struct) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 19 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 20 | public void writeStructEnd (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 21 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 22 | public void writeFieldBegin (TTransport out, |
| 23 | TField field) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 24 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 25 | public void writeFieldEnd (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 26 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 27 | public void writeFieldStop (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 28 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 29 | public void writeMapBegin (TTransport out, |
| 30 | TMap map) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 31 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 32 | public void writeMapEnd (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 33 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 34 | public void writeListBegin (TTransport out, |
| 35 | TList list) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 36 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 37 | public void writeListEnd (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 38 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 39 | public void writeSetBegin (TTransport out, |
| 40 | TSet set) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 41 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 42 | public void writeSetEnd (TTransport out) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 43 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 44 | public void writeByte (TTransport out, |
| 45 | byte b) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 46 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 47 | public void writeU32 (TTransport out, |
| 48 | int u32) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 49 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 50 | public void writeI32 (TTransport out, |
| 51 | int i32) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 52 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 53 | public void writeU64 (TTransport out, |
| 54 | long u64) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 55 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 56 | public void writeI64 (TTransport out, |
| 57 | long i64) throws TException; |
| 58 | |
| 59 | public void writeString (TTransport out, |
| 60 | String str) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Reading methods. |
| 64 | */ |
| 65 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 66 | public TStruct readStructBegin (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 67 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 68 | public void readStructEnd (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 69 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 70 | public TField readFieldBegin (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 71 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 72 | public void readFieldEnd (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 73 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 74 | public TMap readMapBegin (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 75 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 76 | public void readMapEnd (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 77 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 78 | public TList readListBegin (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 79 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 80 | public void readListEnd (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 81 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 82 | public TSet readSetBegin (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 83 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 84 | public void readSetEnd (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 85 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 86 | public byte readByte (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 87 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 88 | public int readU32 (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 89 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 90 | public int readI32 (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 91 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 92 | public long readU64 (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 93 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 94 | public long readI64 (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 95 | |
Mark Slee | 530fd66 | 2006-08-09 00:05:18 +0000 | [diff] [blame^] | 96 | public String readString (TTransport in) throws TException; |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 97 | |
| 98 | } |