Class TTextProtocol
@Deprecated public final class TTextProtocol extends TProtocol
For an example, see: tests/resources/com/twitter/common/thrift/text/TTextProtocol_TestData.txt
which is a text encoding of the thrift message defined in:
src/main/thrift/com/twitter/common/thrift/text/TTextProtocolTest.thrift
Whitespace (including newlines) is not significant.
No comments are allowed in the json.
Messages must be formatted as a JSON object with a field 'method' containing
the message name, 'type' containing the message type as an uppercase string
corresponding to TMessageType, 'args' containing a JSON object with
the actual arguments, and an optional 'seqid' field containing the sequence
id. If 'seqid' is not provided, it will be treated as 0. 'args' should use
the argument names as defined in the service definition.
Example:
{
"method": "GetItem",
"type": "CALL",
"args": {
"id": 1,
"fetchAll": true
},
"seqid": 100
}
TODO(Alex Roetter): write a wrapper that allows us to read in a file of many structs (perhaps stored in a JsonArray), passing each struct to this class for parsing.
See thrift's @see org.apache.thrift.protocol.TJSONProtocol for another example an implementation of the @see TProtocol interface. This class is based on that.
TODO(Alex Roetter): Also add a new TEXT_PROTOCOL field to ThriftCodec
TODO: Support map enum keys specified as strings.
TODO: Support string values for enums that have been typedef'd.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TTextProtocol(TTransport trans)Deprecated.TTextProtocol(TTransport trans, boolean useNamedEnums)Deprecated. -
Method Summary
Modifier and Type Method Description Class<? extends IScheme>getScheme()Deprecated.ByteBufferreadBinary()Deprecated.booleanreadBool()Deprecated.bytereadByte()Deprecated.doublereadDouble()Deprecated.TFieldreadFieldBegin()Deprecated.voidreadFieldEnd()Deprecated.shortreadI16()Deprecated.intreadI32()Deprecated.longreadI64()Deprecated.TListreadListBegin()Deprecated.voidreadListEnd()Deprecated.TMapreadMapBegin()Deprecated.voidreadMapEnd()Deprecated.TMessagereadMessageBegin()Deprecated.voidreadMessageEnd()Deprecated.TSetreadSetBegin()Deprecated.voidreadSetEnd()Deprecated.StringreadString()Deprecated.TStructreadStructBegin()Deprecated.voidreadStructEnd()Deprecated.voidreset()Deprecated.voidwriteBinary(ByteBuffer buf)Deprecated.voidwriteBool(boolean b)Deprecated.voidwriteByte(byte b)Deprecated.voidwriteDouble(double dub)Deprecated.voidwriteFieldBegin(TField field)Deprecated.voidwriteFieldEnd()Deprecated.voidwriteFieldStop()Deprecated.voidwriteI16(short i16)Deprecated.voidwriteI32(int i32)Deprecated.voidwriteI64(long i64)Deprecated.voidwriteListBegin(TList list)Deprecated.voidwriteListEnd()Deprecated.voidwriteMapBegin(TMap map)Deprecated.voidwriteMapEnd()Deprecated.voidwriteMessageBegin(TMessage message)Deprecated.I believe these two messages are called for a thrift service interface.voidwriteMessageEnd()Deprecated.voidwriteSetBegin(TSet set)Deprecated.voidwriteSetEnd()Deprecated.voidwriteString(String str)Deprecated.voidwriteStructBegin(TStruct struct)Deprecated.voidwriteStructEnd()Deprecated.
-
Constructor Details
-
TTextProtocol
Deprecated.Create a parser which can read from trans, and create the output writer that can write to a TTransport. -
TTextProtocol
Deprecated.Create a parser which can read from trans, and create the output writer that can write to a TTransport, optionally enabling serialization of named enums.
-
-
Method Details
-
getScheme
Deprecated. -
reset
public void reset()Deprecated. -
writeMessageBegin
Deprecated.I believe these two messages are called for a thrift service interface. We don't plan on storing any text objects of that type on disk.- Specified by:
writeMessageBeginin classTProtocol- Throws:
TException
-
writeMessageEnd
Deprecated.- Specified by:
writeMessageEndin classTProtocol- Throws:
TException
-
writeStructBegin
Deprecated.- Specified by:
writeStructBeginin classTProtocol- Throws:
TException
-
writeStructEnd
Deprecated.- Specified by:
writeStructEndin classTProtocol- Throws:
TException
-
writeFieldBegin
Deprecated.- Specified by:
writeFieldBeginin classTProtocol- Throws:
TException
-
writeFieldEnd
Deprecated.- Specified by:
writeFieldEndin classTProtocol- Throws:
TException
-
writeFieldStop
Deprecated.- Specified by:
writeFieldStopin classTProtocol- Throws:
TException
-
writeMapBegin
Deprecated.- Specified by:
writeMapBeginin classTProtocol- Throws:
TException
-
writeMapEnd
Deprecated.- Specified by:
writeMapEndin classTProtocol- Throws:
TException
-
writeListBegin
Deprecated.- Specified by:
writeListBeginin classTProtocol- Throws:
TException
-
writeListEnd
Deprecated.- Specified by:
writeListEndin classTProtocol- Throws:
TException
-
writeSetBegin
Deprecated.- Specified by:
writeSetBeginin classTProtocol- Throws:
TException
-
writeSetEnd
Deprecated.- Specified by:
writeSetEndin classTProtocol- Throws:
TException
-
writeBool
Deprecated.- Specified by:
writeBoolin classTProtocol- Throws:
TException
-
writeByte
Deprecated.- Specified by:
writeBytein classTProtocol- Throws:
TException
-
writeI16
Deprecated.- Specified by:
writeI16in classTProtocol- Throws:
TException
-
writeI32
Deprecated.- Specified by:
writeI32in classTProtocol- Throws:
TException
-
writeI64
Deprecated.- Specified by:
writeI64in classTProtocol- Throws:
TException
-
writeDouble
Deprecated.- Specified by:
writeDoublein classTProtocol- Throws:
TException
-
writeString
Deprecated.- Specified by:
writeStringin classTProtocol- Throws:
TException
-
writeBinary
Deprecated.- Specified by:
writeBinaryin classTProtocol- Throws:
TException
-
readMessageBegin
Deprecated.- Specified by:
readMessageBeginin classTProtocol- Throws:
TException
-
readMessageEnd
Deprecated.- Specified by:
readMessageEndin classTProtocol- Throws:
TException
-
readStructBegin
Deprecated.- Specified by:
readStructBeginin classTProtocol- Throws:
TException
-
readStructEnd
Deprecated.- Specified by:
readStructEndin classTProtocol- Throws:
TException
-
readFieldBegin
Deprecated.- Specified by:
readFieldBeginin classTProtocol- Throws:
TException
-
readFieldEnd
Deprecated.- Specified by:
readFieldEndin classTProtocol- Throws:
TException
-
readMapBegin
Deprecated.- Specified by:
readMapBeginin classTProtocol- Throws:
TException
-
readMapEnd
Deprecated.- Specified by:
readMapEndin classTProtocol- Throws:
TException
-
readListBegin
Deprecated.- Specified by:
readListBeginin classTProtocol- Throws:
TException
-
readListEnd
Deprecated.- Specified by:
readListEndin classTProtocol- Throws:
TException
-
readSetBegin
Deprecated.- Specified by:
readSetBeginin classTProtocol- Throws:
TException
-
readSetEnd
Deprecated.- Specified by:
readSetEndin classTProtocol- Throws:
TException
-
readBool
Deprecated.- Specified by:
readBoolin classTProtocol- Throws:
TException
-
readByte
Deprecated.- Specified by:
readBytein classTProtocol- Throws:
TException
-
readI16
Deprecated.- Specified by:
readI16in classTProtocol- Throws:
TException
-
readI32
Deprecated.- Specified by:
readI32in classTProtocol- Throws:
TException
-
readI64
Deprecated.- Specified by:
readI64in classTProtocol- Throws:
TException
-
readDouble
Deprecated.- Specified by:
readDoublein classTProtocol- Throws:
TException
-
readString
Deprecated.- Specified by:
readStringin classTProtocol- Throws:
TException
-
readBinary
Deprecated.- Specified by:
readBinaryin classTProtocol- Throws:
TException
-