在这段代码中,我正在从流中读取一个值。但是 readline() 方法占用了更多的 CPU。你能帮我为什么会这样,并给我建议以尽量减少 CPU 使用率。
HttpURLConnection request = (HttpURLConnection) url.openConnection();
request.setRequestMethod("POST");
request.setRequestProperty("Content-Length", "0");
request.setUseCaches(false);
InputStreamReader in = new InputStreamReader((InputStream) request.getContent());
BufferedReader buff = new BufferedReader(in);
while(line = buff.readLine() != null) {
System.out.print("hello");
}