Skip to content

Most visited

Recently visited

navigation

LinkAddress

public class LinkAddress
extends Object implements Parcelable

java.lang.Object
   ↳ android.net.LinkAddress


Identifies an IP address on a network link. A LinkAddress consists of:

  • An IP address and prefix length (e.g., 2001:db8::1/64 or 192.0.2.1/24). The address must be unicast, as multicast addresses cannot be assigned to interfaces.
  • Address flags: A bitmask of OsConstants.IFA_F_* values representing properties of the address (e.g., android.system.OsConstants.IFA_F_OPTIMISTIC).
  • Address scope: One of the OsConstants.IFA_F_* values; defines the scope in which the address is unique (e.g., android.system.OsConstants.RT_SCOPE_LINK or android.system.OsConstants.RT_SCOPE_UNIVERSE).

Summary

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<LinkAddress> CREATOR

Implement the Parcelable interface.

Public methods

int describeContents()

Implement the Parcelable interface.

boolean equals(Object obj)

Compares this LinkAddress instance against obj.

InetAddress getAddress()

Returns the InetAddress of this LinkAddress.

int getFlags()

Returns the flags of this LinkAddress.

int getPrefixLength()

Returns the prefix length of this LinkAddress.

int getScope()

Returns the scope of this LinkAddress.

int hashCode()

Returns a hashcode for this address.

String toString()

Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64".

void writeToParcel(Parcel dest, int flags)

Implement the Parcelable interface.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

CREATOR

added in API level 21
Creator<LinkAddress> CREATOR

Implement the Parcelable interface.

Public methods

describeContents

added in API level 21
int describeContents ()

Implement the Parcelable interface.

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)

Compares this LinkAddress instance against obj. Two addresses are equal if their address, prefix length, flags and scope are equal. Thus, for example, two addresses that have the same address and prefix length are not equal if one of them is deprecated and the other is not.

Parameters
obj Object: the object to be tested for equality.

Returns
boolean true if both objects are equal, false otherwise.

getAddress

added in API level 21
InetAddress getAddress ()

Returns the InetAddress of this LinkAddress.

Returns
InetAddress

getFlags

added in API level 21
int getFlags ()

Returns the flags of this LinkAddress.

Returns
int

getPrefixLength

added in API level 21
int getPrefixLength ()

Returns the prefix length of this LinkAddress.

Returns
int

getScope

added in API level 21
int getScope ()

Returns the scope of this LinkAddress.

Returns
int

hashCode

added in API level 21
int hashCode ()

Returns a hashcode for this address.

Returns
int a hash code value for this object.

toString

added in API level 21
String toString ()

Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64". The string representation does not contain the flags and scope, just the address and prefix length.

Returns
String a string representation of the object.

writeToParcel

added in API level 21
void writeToParcel (Parcel dest, 
                int flags)

Implement the Parcelable interface.

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.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)