public abstract class URLStreamHandler extends Object
URLStreamHandler是所有流协议处理程序的共同父类。流协议处理程序知道如何为一个特定的协议类型进行连接,如
http或
https。
在大多数情况下,一个URLStreamHandler子类的实例是不能直接由应用程序创建的。相反,第一次协议名称时构建一个URL,适当的流协议处理程序自动加载。
URL.URL(java.lang.String, java.lang.String, int, java.lang.String)
| Constructor and Description |
|---|
URLStreamHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
equals(URL u1, URL u2)
提供默认的等于计算。
|
protected int |
getDefaultPort()
返回此处理程序解析的一个链接的默认端口。
|
protected InetAddress |
getHostAddress(URL u)
获取我们主机的IP地址。
|
protected int |
hashCode(URL u)
提供默认哈希计算。
|
protected boolean |
hostsEqual(URL u1, URL u2)
比较两个网址的主机组件。
|
protected abstract URLConnection |
openConnection(URL u)
打开一个连接的
URL参数引用的对象。
|
protected URLConnection |
openConnection(URL u, Proxy p)
同OpenConnection(URL),除了连接将通过指定的代理进行;协议处理程序不支持代理将忽略代理参数,使正常的连接。
|
protected void |
parseURL(URL u, String spec, int start, int limit)
解析一个
URL字符串表示一个
URL对象。
|
protected boolean |
sameFile(URL u1, URL u2)
比较两个网址,看看它们是否指向同一个文件,即具有相同的协议、主机、端口和路径。
|
protected void |
setURL(URL u, String protocol, String host, int port, String file, String ref)
过时的。
使用seturl(URL字符串,字符串,整数,字符串,字符串,字符串,字符串);
|
protected void |
setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref)
套的
URL争论的领域为指定值。
|
protected String |
toExternalForm(URL u)
将
URL一到
String具体协议。
|
protected abstract URLConnection openConnection(URL u) throws IOException
URL参数引用的对象。这种方法可以被子类覆盖。
如果该处理程序的协议(如HTTP或罐),存在一个公共、专业URLConnection类属于以下其中一个包或一个一个的子包:,,根据,java.net,连接返回将那类。例如,HTTP的你会回来,并将返回一个jarurlconnection罐。
u -这个连接URL。
URL一
URLConnection对象。
IOException如果I/O错误发生在打开连接。
protected URLConnection openConnection(URL u, Proxy p) throws IOException
u -这个连接URL。
p -代理通过该连接将。如果直接连接是需要的,proxy.no_proxy应指定。
URL一
URLConnection对象。
IOException如果I/O错误发生在打开连接。
IllegalArgumentException如果u或P是无效的,或有错误的类型。
UnsupportedOperationException如果实现协议不支持此方法的类。
protected void parseURL(URL u, String spec, int start, int limit)
URL字符串表示一个
URL对象。
如果有任何继承的语境,那么它已经被复制到URL论点。
对URLStreamHandler的parseURL方法解析的字符串表示形式,如果它是一个http规范。大多数的网址协议家庭有一个类似的分析。有一个不同的语法的协议的流协议处理程序必须重写此例程。
u -
URL接收解析结果的规格。
spec代表URL必须解析
String。
start -特征指标在开始解析。这是刚刚过去的“
:”(如果有)指定协议名称的确定。
limit的字符位置时停止解析。这是字符串或“
#”字符的位置结束,如果存在。尖锐的标志后的所有信息表明一个锚。
protected int getDefaultPort()
URL解析此处理程序的默认端口。
protected boolean equals(URL u1, URL u2)
u1 -一个URL对象
u2 -一个URL对象
true如果两个网址都是相同的,即它们指的是在同一个文件中相同的片段。
protected int hashCode(URL u)
u -一个URL对象
int
protected boolean sameFile(URL u1, URL u2)
u1 -一个URL对象
u2 -一个URL对象
protected InetAddress getHostAddress(URL u)
u -一个URL对象
InetAddress。
protected boolean hostsEqual(URL u1, URL u2)
u1 -第一主机比较URL
u2 -第二主机比较URL
true当且仅当他们是平等的,
false否则。
protected String toExternalForm(URL u)
URL一到
String具体协议。
u的URL。
URL参数的字符串表示形式。
protected void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref)
URL争论的领域为指定值。只有派生类的urlstreamhandler能够使用这个方法来设置URL的字段的值。
u - URL修改。
protocol -协议名称。
host - URL远程主机的价值。
port -在远程机器上的端口。
authority为URL的部分权限。
userInfo - URL的用户信息部分。
path - URL的路径部分。
query - URL的查询部分。
ref -参考。
SecurityException如果URL协议处理程序不同于这一
URL.set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
@Deprecated protected void setURL(URL u, String protocol, String host, int port, String file, String ref)
URL争论的领域为指定值。只有派生类的urlstreamhandler能够使用这个方法来设置URL的字段的值。
u - URL修改。
protocol -协议名称。此值自1.2以来被忽略。
host - URL远程主机的价值。
port -在远程机器上的端口。
file -文件。
ref -参考。
SecurityException如果URL协议处理程序不同于这一
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.