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