亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java中流的關閉

Java中流的關閉

慕桂英546537 2019-01-19 15:32:46
1.response.getWriter().print(""); 2.PrintWriter out = response.getWriter(); out.print(""); out.close(); 第一種方式可以嗎?流會自動關閉嗎?
查看完整描述

2 回答

?
呼如林

TA貢獻1798條經驗 獲得超3個贊

response.getWriter().print("");不會自動關閉

response.getWriter源碼
public PrintWriter getWriter()
/*     */     throws IOException
/*     */   {
/* 213 */     PrintWriter writer = this.response.getWriter();
/* 214 */     if (isFinished()) {
/* 215 */       this.response.setSuspended(true);
/*     */     }
/* 217 */     return writer;
/*     */   }
print方法源碼
public void print(String s) {
        if (s == null) {
            s = "null";
        }
        write(s);
    }
    
查看完整回答
反對 回復 2019-02-12
  • 2 回答
  • 0 關注
  • 731 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號