URLConnection,HttpURLConnection和HttpsURLConnection之间的区别 [英] Difference between URLConnection, HttpURLConnection and HttpsURLConnection

查看:805
本文介绍了URLConnection,HttpURLConnection和HttpsURLConnection之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

URLConnection HttpURLConnection HttpsURLConnection (使用SSL)。在什么条件下,我应该使用哪一个?

What is the difference between URLConnection, HttpURLConnection and HttpsURLConnection (with SSL). Under what conditions, which one should I use?

推荐答案

URLConnection 是基类。

HttpURLConnection 是一个派生类,当您需要额外的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.

HttpsURLConnection 是一个更多派生的类,您可以在需要更多额外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之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆