3

I'd like to implement streaming using Thrift (upload/download), but I don't see support for a streaming type in the list of Thrift supported types.

The closes data type is binary, but it's translated to a ByteBuffer in Java. The problem with a ByteBuffer is that the content must be preloaded into memory because it's backed by a byte array - not really streaming.

How to do byte streaming using Thrift?

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
  • 1
    The question has been asked (and debated) a number of times, both [here on SO](http://stackoverflow.com/search?q=%5Bthrift%5D+stream) as well as [on the mailing lists/JIRA](https://issues.apache.org/jira/browse/THRIFT-1948). The biggest argument against a streaming feature is the platform/transport abstraction. But that does not mean it is impossible to stream contents with Thrift to a client, you just will have to invest a bit more work. That's the status of today, maybe it changes in the future. – JensG Jan 04 '15 at 17:40
  • 1
    possible duplicate of [Sending a stream as a property in Apache Thrift C#](http://stackoverflow.com/questions/16170377/sending-a-stream-as-a-property-in-apache-thrift-c-sharp) – JensG Jan 04 '15 at 17:44
  • 1
    "*The problem [...] content must be preloaded into memory*" - Not really. Somewhere in the pipeline someone will have to load chunks of the data into memory. It is not a question of "if", only one of "when" and "by whom". – JensG Jan 04 '15 at 17:47

0 Answers0