I want to rewrite a snippet of python code into java. Python code is listed below:
transport = StringIO(thrifts_data)
transport.seek(0)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
....
doc = StreamItem()
doc.read(protocol)
In the above code, thrifts_data are binary streams read from files.
Now I need to rewrite it in java, I have searched on the web, but nothing useful has been found.
In java, TTransport is an abstract class and it has some subclasses, but I’m not sure which should I choose, because nobody of them contains a construct method that takes a inputstream parameter.
Can anyone help me? Thanks in advance.
TIOStreamTransporthas a constructor withInputStreamargument.You might be also interested in
TMemoryInputTransportandTFileTransport.