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.ByteBuffer
readBinary()
Deprecated.boolean
readBool()
Deprecated.byte
readByte()
Deprecated.double
readDouble()
Deprecated.TField
readFieldBegin()
Deprecated.void
readFieldEnd()
Deprecated.short
readI16()
Deprecated.int
readI32()
Deprecated.long
readI64()
Deprecated.TList
readListBegin()
Deprecated.void
readListEnd()
Deprecated.TMap
readMapBegin()
Deprecated.void
readMapEnd()
Deprecated.TMessage
readMessageBegin()
Deprecated.void
readMessageEnd()
Deprecated.TSet
readSetBegin()
Deprecated.void
readSetEnd()
Deprecated.String
readString()
Deprecated.TStruct
readStructBegin()
Deprecated.void
readStructEnd()
Deprecated.void
reset()
Deprecated.void
writeBinary(ByteBuffer buf)
Deprecated.void
writeBool(boolean b)
Deprecated.void
writeByte(byte b)
Deprecated.void
writeDouble(double dub)
Deprecated.void
writeFieldBegin(TField field)
Deprecated.void
writeFieldEnd()
Deprecated.void
writeFieldStop()
Deprecated.void
writeI16(short i16)
Deprecated.void
writeI32(int i32)
Deprecated.void
writeI64(long i64)
Deprecated.void
writeListBegin(TList list)
Deprecated.void
writeListEnd()
Deprecated.void
writeMapBegin(TMap map)
Deprecated.void
writeMapEnd()
Deprecated.void
writeMessageBegin(TMessage message)
Deprecated.I believe these two messages are called for a thrift service interface.void
writeMessageEnd()
Deprecated.void
writeSetBegin(TSet set)
Deprecated.void
writeSetEnd()
Deprecated.void
writeString(String str)
Deprecated.void
writeStructBegin(TStruct struct)
Deprecated.void
writeStructEnd()
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:
writeMessageBegin
in classTProtocol
- Throws:
TException
-
writeMessageEnd
Deprecated.- Specified by:
writeMessageEnd
in classTProtocol
- Throws:
TException
-
writeStructBegin
Deprecated.- Specified by:
writeStructBegin
in classTProtocol
- Throws:
TException
-
writeStructEnd
Deprecated.- Specified by:
writeStructEnd
in classTProtocol
- Throws:
TException
-
writeFieldBegin
Deprecated.- Specified by:
writeFieldBegin
in classTProtocol
- Throws:
TException
-
writeFieldEnd
Deprecated.- Specified by:
writeFieldEnd
in classTProtocol
- Throws:
TException
-
writeFieldStop
Deprecated.- Specified by:
writeFieldStop
in classTProtocol
- Throws:
TException
-
writeMapBegin
Deprecated.- Specified by:
writeMapBegin
in classTProtocol
- Throws:
TException
-
writeMapEnd
Deprecated.- Specified by:
writeMapEnd
in classTProtocol
- Throws:
TException
-
writeListBegin
Deprecated.- Specified by:
writeListBegin
in classTProtocol
- Throws:
TException
-
writeListEnd
Deprecated.- Specified by:
writeListEnd
in classTProtocol
- Throws:
TException
-
writeSetBegin
Deprecated.- Specified by:
writeSetBegin
in classTProtocol
- Throws:
TException
-
writeSetEnd
Deprecated.- Specified by:
writeSetEnd
in classTProtocol
- Throws:
TException
-
writeBool
Deprecated.- Specified by:
writeBool
in classTProtocol
- Throws:
TException
-
writeByte
Deprecated.- Specified by:
writeByte
in classTProtocol
- Throws:
TException
-
writeI16
Deprecated.- Specified by:
writeI16
in classTProtocol
- Throws:
TException
-
writeI32
Deprecated.- Specified by:
writeI32
in classTProtocol
- Throws:
TException
-
writeI64
Deprecated.- Specified by:
writeI64
in classTProtocol
- Throws:
TException
-
writeDouble
Deprecated.- Specified by:
writeDouble
in classTProtocol
- Throws:
TException
-
writeString
Deprecated.- Specified by:
writeString
in classTProtocol
- Throws:
TException
-
writeBinary
Deprecated.- Specified by:
writeBinary
in classTProtocol
- Throws:
TException
-
readMessageBegin
Deprecated.- Specified by:
readMessageBegin
in classTProtocol
- Throws:
TException
-
readMessageEnd
Deprecated.- Specified by:
readMessageEnd
in classTProtocol
- Throws:
TException
-
readStructBegin
Deprecated.- Specified by:
readStructBegin
in classTProtocol
- Throws:
TException
-
readStructEnd
Deprecated.- Specified by:
readStructEnd
in classTProtocol
- Throws:
TException
-
readFieldBegin
Deprecated.- Specified by:
readFieldBegin
in classTProtocol
- Throws:
TException
-
readFieldEnd
Deprecated.- Specified by:
readFieldEnd
in classTProtocol
- Throws:
TException
-
readMapBegin
Deprecated.- Specified by:
readMapBegin
in classTProtocol
- Throws:
TException
-
readMapEnd
Deprecated.- Specified by:
readMapEnd
in classTProtocol
- Throws:
TException
-
readListBegin
Deprecated.- Specified by:
readListBegin
in classTProtocol
- Throws:
TException
-
readListEnd
Deprecated.- Specified by:
readListEnd
in classTProtocol
- Throws:
TException
-
readSetBegin
Deprecated.- Specified by:
readSetBegin
in classTProtocol
- Throws:
TException
-
readSetEnd
Deprecated.- Specified by:
readSetEnd
in classTProtocol
- Throws:
TException
-
readBool
Deprecated.- Specified by:
readBool
in classTProtocol
- Throws:
TException
-
readByte
Deprecated.- Specified by:
readByte
in classTProtocol
- Throws:
TException
-
readI16
Deprecated.- Specified by:
readI16
in classTProtocol
- Throws:
TException
-
readI32
Deprecated.- Specified by:
readI32
in classTProtocol
- Throws:
TException
-
readI64
Deprecated.- Specified by:
readI64
in classTProtocol
- Throws:
TException
-
readDouble
Deprecated.- Specified by:
readDouble
in classTProtocol
- Throws:
TException
-
readString
Deprecated.- Specified by:
readString
in classTProtocol
- Throws:
TException
-
readBinary
Deprecated.- Specified by:
readBinary
in classTProtocol
- Throws:
TException
-