Okhttp流请求到服务器

Okhttp流请求到服务器

本文介绍了Okhttp流请求到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用OkHttp将语音请求发送到服务器.我记录并收集了全部数据,然后将请求发送到服务器.我可以在记录自身时使用OkHttp将数据请求流式传输到服务器吗?

I am currently using OkHttp to send Voice request to server. I record and collect the whole data and then send the request to server.Can I use OkHttp to stream the data request to server while recording itself?

推荐答案

为时已晚!我假设您已经找到了答案,但是对于将来的访问者.

Too late! I am assuming you already found your answer, but for future visitors..

是的.可以使用okHttp与Okio的Pipe类异步发送流数据. https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java 话虽如此,您始终可以将java.io类与BlockingQueue<E>

Yes. okHttp can be used send streaming data asynchronously with Pipe class of Okio.https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/PostStreaming.javaHaving said that, you can always use java.io class with BlockingQueue<E>

这篇关于Okhttp流请求到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 07:37