Okhttp流请求到服务器 [英] Okhttp Stream Request to Server

查看:92
本文介绍了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类异步发送流数据.

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.java Having said that, you can always use java.io class with BlockingQueue<E>

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆