62,614
社区成员
发帖
与我相关
我的任务
分享
public void close() throws IOException {
// Prevent recursion. See BugId 4484411
if (closing)
return;
closing = true;
if (socket != null) {
if (!socket.isClosed())
socket.close();//这里关闭了Socket
} else
impl.close();//这里关闭了SocketImpl
closing = false;
}
也就是说,你执行dops.close()的同时也把Socket so关闭了。
但是还是建议养成关闭的习惯,小心驶得万年船啊!!
PS:debug中会经过StreamEncoder,StreamEncoder代码如下
http://www.docjar.com/html/api/sun/nio/cs/StreamEncoder.java.html