Java:URLConnection 中 setDoInput 的目的是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11328043/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 04:40:36  来源:igfitidea点击:

Java: What is the purpose of setDoInput in URLConnection

javahttp-posturlconnection

提问by Teererai Marange

Possible Duplicate:
Java HttpURLConnection

可能重复:
Java HttpURLConnection

Would this method be used for example if I want to read the response to a POST method call from the server I am connected to?

例如,如果我想从我连接的服务器读取对 POST 方法调用的响应,是否会使用此方法?

采纳答案by user207421

I've never encountered a case for setting it false. You always want to read something, at least the response code.

我从未遇到过将其设置为 false 的情况。你总是想阅读一些东西,至少是响应代码。