Frage

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 ?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top