Servlets PrintWriter out 流真的需要关闭吗?
2022-09-04 20:00:59
我写了一个简单的 servlet,如下所示:
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
// [do stuff with the PrintWriter]
out.close();
}
}
是否有必要关闭流?如果我不关闭流,是否会进一步影响?PrintWriter