public final class Scheme
extends java.lang.Object
SchemeRegistry
.
For example, to configure support for "https://" URLs, you could write code like the following:
Scheme https = new Scheme("https", new MySecureSocketFactory(), 443); SchemeRegistry.DEFAULT.register(https);
Constructor and Description |
---|
Scheme(java.lang.String name,
SocketFactory factory,
int port)
Creates a new scheme.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this scheme to an object.
|
int |
getDefaultPort()
Obtains the default port.
|
java.lang.String |
getName()
Obtains the scheme name.
|
SocketFactory |
getSocketFactory()
Obtains the socket factory.
|
int |
hashCode()
Obtains a hash code for this scheme.
|
boolean |
isLayered()
Indicates whether this scheme allows for layered connections.
|
int |
resolvePort(int port)
Resolves the correct port for this scheme.
|
java.lang.String |
toString()
Return a string representation of this object.
|
public Scheme(java.lang.String name, SocketFactory factory, int port)
factory
.name
- the scheme name, for example "http".
The name will be converted to lowercase.factory
- the factory for creating sockets for communication
with this schemeport
- the default port for this schemepublic final int getDefaultPort()
public final SocketFactory getSocketFactory()
layered
, the factory implements
LayeredSocketFactory
.public final java.lang.String getName()
public final boolean isLayered()
true
if layered connections are possible,
false
otherwisepublic final int resolvePort(int port)
port
- the port to be resolved,
a negative number to obtain the default portpublic final java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare withtrue
iff the argument is equal to this schemepublic int hashCode()
hashCode
in class java.lang.Object