質問

Suppose I am using dispatch to call a REST API in Scala. The API may return very large responses that don't fit the memory I have.

So I would like to read a response from the network in a fixed-size buffer and raise an exception (return an error) if the response size > the buffer size.

How can I do it with the dispatch library ?

役に立ちましたか?

解決

Use one of the stream conversion operators, such as >>, to get an input stream and check the content of the stream for length, etc.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top