Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
[#] 提高HTTP/HTTPS服务效率
Browse files Browse the repository at this point in the history
同样感谢那名群友提出的优化方法
  • Loading branch information
NekoCurit committed Feb 3, 2024
1 parent 0c08e64 commit 8c61721
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ public void handle(HttpExchange t) throws IOException {
}
private String Stream2String(InputStream stream) {
StringBuilder sb = new StringBuilder();
try (InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
int c;
while ((c = reader.read()) != -1) {
sb.append((char) c);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
// TODO: handle exception
Expand Down

0 comments on commit 8c61721

Please sign in to comment.