如何超出get方法的返回字符串(httpurlconnection)
我使用 HTTPUrlConnection 和 GET 方法从服务器获取数据,返回字符串大约 13k 个字符,但我只收到 1228 个字符。
有什么解决方案可以超过接收所有字符吗?
这是我的代码:
URL con = new URL(url);
HttpURLConnection httpURLCon = (HttpURLConnection)con.openConnection();
DataInputStream inStream = new DataInputStream(httpURLCon.getInputStream());
Scanner sc = new Scanner(inStream);
String response = sc.next();
System.out.prinlnt(response.length());
I use HTTPUrlConnection with GET method to get data from the server, and the return string about 13k characters, but I'm just receive 1228 characters.
Any solution to exceed to receive all characters?
This is my code:
URL con = new URL(url);
HttpURLConnection httpURLCon = (HttpURLConnection)con.openConnection();
DataInputStream inStream = new DataInputStream(httpURLCon.getInputStream());
Scanner sc = new Scanner(inStream);
String response = sc.next();
System.out.prinlnt(response.length());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只是读取一行输入。
You are just reading one line of the input.