gpt4 book ai didi

java - URLConnection 连接的 getter

转载 作者:行者123 更新时间:2023-11-29 05:00:57 24 4
gpt4 key购买 nike

我正在检查 URLConnection 的文档类,我无法为 connected 字段找到 getter/setter。虽然有 getDoInput() ,但没有 isConnected()。所以我想知道是否有方法或其他方法来检查这一点。

最佳答案

如果已经有一个连接,你可以简单地调用 connect() 没有任何反应。

请参阅connect 方法的文档:

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored.

关于java - URLConnection 连接的 getter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32119742/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com