我有以下代码:
httpUrlConnection = (HttpURLConnection) new URL(URL).openConnection();
InputStream in = new BufferedInputStream(httpUrlConnection.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));我的问题是,我是否可以将第二行替换为"InputStream in =httpUrlConnection.getInputStream();“?会有什么不同吗?
发布于 2017-07-23 04:39:53
我建议不要。从互联网上收到的信息是以包裹的形式出现的,包裹到来的顺序和速度会有所不同。BufferedInputStream会自动管理它们,而InputStream可能会导致问题。感谢您在论坛中发帖!
https://stackoverflow.com/questions/45256942
复制相似问题