Encapsulates specifics of a protocol scheme such as "http" or "https". More...
Schemes are identified by lowercase names. Supported schemes are typically collected in a 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);
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
Scheme (final String name, final SocketFactory factory, final int port) | |
Creates a new scheme. More... | |
final int | getDefaultPort () |
Obtains the default port. More... | |
final SocketFactory | getSocketFactory () |
Obtains the socket factory. More... | |
final String | getName () |
Obtains the scheme name. More... | |
final boolean | isLayered () |
Indicates whether this scheme allows for layered connections. More... | |
final int | resolvePort (int port) |
Resolves the correct port for this scheme. More... | |
final String | toString () |
Return a string representation of this object. More... | |
final boolean | equals (Object obj) |
Compares this scheme to an object. More... | |
int | hashCode () |
Obtains a hash code for this scheme. More... | |
Scheme | ( | final String | name, |
final SocketFactory | factory, | ||
final int | port | ||
) |
Whether the created scheme allows for layered connections depends on the class of 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 scheme |
port | the default port for this scheme |
final int getDefaultPort | ( | ) |
final SocketFactory getSocketFactory | ( | ) |
If this scheme is layered , the factory implements LayeredSocketFactory .
final String getName | ( | ) |
final boolean isLayered | ( | ) |
true
if layered connections are possible, false
otherwise final int resolvePort | ( | int | port | ) |
Returns the given port if it is valid, the default port otherwise.
port | the port to be resolved, a negative number to obtain the default port |
final String toString | ( | ) |
final boolean equals | ( | Object | obj | ) |
obj | the object to compare with |
true
iff the argument is equal to this scheme int hashCode | ( | ) |