问题描述
URLConnection
, HttpURLConnection
和 HttpsURLConnection $ c $之间有什么区别? c>(使用SSL)。在什么条件下,我应该使用哪一个?
What is the difference between URLConnection
, HttpURLConnection
and HttpsURLConnection
(with SSL). Under what conditions, which one should I use?
推荐答案
是基类。
是一个派生类,当您需要额外的API并且只处理HTTP或HTTPS时,可以使用它。
HttpURLConnection
is a derived class which you can use when you need the extra API and you are dealing with HTTP or HTTPS only.
是一个更多派生的类,您可以在需要更多额外API并且仅处理HTTPS时使用该类。
HttpsURLConnection
is a 'more derived' class which you can use when you need the 'more extra' API and you are dealing with HTTPS only.
所有这三个都是抽象的,并且由您不熟悉的特定类实现。
All three of them are abstract, and implemented by specific classes you aren't privy to.
这篇关于URLConnection,HttpURLConnection和HttpsURLConnection之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!