public final class RouteInfo
extends Object
implements Parcelable
java.lang.Object | |
↳ | android.net.RouteInfo |
代表一个网络路线。
这用于描述静态网络配置和实时网络配置信息。 路线包含三条信息:
IpPrefix
specifying the network destinations covered by this route. If this is null
it indicates a default route of the address family (IPv4 or IPv6) implied by the gateway IP address. InetAddress
indicating the next hop to use. If this is null
it indicates a directly-connected route. null
, but not both. If the destination and gateway are both specified, they must be of the same address family (IPv4 or IPv6).
Inherited constants |
---|
From interface android.os.Parcelable
|
Fields |
|
---|---|
public static final Creator<RouteInfo> |
CREATOR 实现Parcelable接口。 |
Public methods |
|
---|---|
int |
describeContents() 实现Parcelable接口 |
boolean |
equals(Object obj) 将此RouteInfo对象与指定对象进行比较,并指出它们是否相等。 |
IpPrefix |
getDestination() 以 |
InetAddress |
getGateway() 检索此路由的网关或下一跳 |
String |
getInterface() 如果指定,则检索用于此路由的接口,否则 |
int |
hashCode() 返回此 |
boolean |
isDefaultRoute() 指示此路线是否为默认路线(即,没有指定目的地)。 |
boolean |
matches(InetAddress destination) 确定此路由的目标和前缀是否包含指定的地址。 |
String |
toString() 返回此对象的可读描述。 |
void |
writeToParcel(Parcel dest, int flags) 实现Parcelable接口 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
|
From interface android.os.Parcelable
|
int describeContents ()
实现Parcelable接口
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
boolean equals (Object obj)
将此RouteInfo对象与指定对象进行比较,并指出它们是否相等。
Parameters | |
---|---|
obj |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if the objects are equal, false otherwise. |
IpPrefix getDestination ()
以 IpPrefix
的形式检索目标地址和前缀长度。
Returns | |
---|---|
IpPrefix |
IpPrefix specifying the destination. This is never null . |
InetAddress getGateway ()
检索此路由的网关或下一跳 InetAddress
。
Returns | |
---|---|
InetAddress |
InetAddress specifying the gateway or next hop. This may be null for a directly-connected route." |
String getInterface ()
如果指定,则检索用于此路线的接口,否则 null
。
Returns | |
---|---|
String |
The name of the interface used for this route. |
int hashCode ()
返回此 RouteInfo
对象的哈希 RouteInfo
。
Returns | |
---|---|
int |
a hash code value for this object. |
boolean isDefaultRoute ()
指示此路线是否为默认路线(即,没有指定目的地)。
Returns | |
---|---|
boolean |
true if the destination has a prefix length of 0. |
boolean matches (InetAddress destination)
确定此路由的目标和前缀是否包含指定的地址。
Parameters | |
---|---|
destination |
InetAddress : A InetAddress to test to see if it would match this route. |
Returns | |
---|---|
boolean |
true if the destination and prefix length cover the given address. |
String toString ()
返回此对象的可读描述。
Returns | |
---|---|
String |
a string representation of the object. |
void writeToParcel (Parcel dest, int flags)
实现Parcelable接口
Parameters | |
---|---|
dest |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . |