Most visited

Recently visited

Added in API level 21

RouteInfo

public final class RouteInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.net.RouteInfo


代表一个网络路线。

这用于描述静态网络配置和实时网络配置信息。 路线包含三条信息:

Either the destination or the gateway may be null, but not both. If the destination and gateway are both specified, they must be of the same address family (IPv4 or IPv6).

Summary

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()

IpPrefix的形式检索目标地址和前缀长度。

InetAddress getGateway()

检索此路由的网关或下一跳 InetAddress

String getInterface()

如果指定,则检索用于此路由的接口,否则 null

int hashCode()

返回此 RouteInfo对象的哈希 RouteInfo

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

Fields

CREATOR

Added in API level 21
Creator<RouteInfo> CREATOR

实现Parcelable接口。

Public methods

describeContents

Added in API level 21
int describeContents ()

实现Parcelable接口

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

equals

Added in API level 21
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.

getDestination

Added in API level 21
IpPrefix getDestination ()

IpPrefix的形式检索目标地址和前缀长度。

Returns
IpPrefix IpPrefix specifying the destination. This is never null.

getGateway

Added in API level 21
InetAddress getGateway ()

检索此路由的网关或下一跳 InetAddress

Returns
InetAddress InetAddress specifying the gateway or next hop. This may be null for a directly-connected route."

getInterface

Added in API level 21
String getInterface ()

如果指定,则检索用于此路线的接口,否则 null

Returns
String The name of the interface used for this route.

hashCode

Added in API level 21
int hashCode ()

返回此 RouteInfo对象的哈希 RouteInfo

Returns
int a hash code value for this object.

isDefaultRoute

Added in API level 21
boolean isDefaultRoute ()

指示此路线是否为默认路线(即,没有指定目的地)。

Returns
boolean true if the destination has a prefix length of 0.

matches

Added in API level 21
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.

toString

Added in API level 21
String toString ()

返回此对象的可读描述。

Returns
String a string representation of the object.

writeToParcel

Added in API level 21
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.

Hooray!