Added in API level 21

LinkAddress


open class LinkAddress : Parcelable
kotlin.Any
   ↳ 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
Public methods
open Int

Implement the Parcelable interface.

open Boolean
equals(other: Any?)

Compares this LinkAddress instance against obj.

open InetAddress!

Returns the InetAddress of this LinkAddress.

open Int

Returns the flags of this LinkAddress.

open Int

Returns the prefix length of this LinkAddress.

open Int

Returns the scope of this LinkAddress.

open Int

Returns a hashcode for this address.

open String

Returns a string representation of this address, such as "192.

open Unit
writeToParcel(dest: Parcel, flags: Int)

Implement the Parcelable interface.

Properties
static Parcelable.Creator<LinkAddress!>

Implement the Parcelable interface.

Public methods

describeContents

Added in API level 21
open fun describeContents(): Int

Implement the Parcelable interface.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 21
open fun equals(other: Any?): Boolean

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 the object to be tested for equality. This value may be null.
Return
Boolean true if both objects are equal, false otherwise.

getAddress

Added in API level 21
open fun getAddress(): InetAddress!

Returns the InetAddress of this LinkAddress.

getFlags

Added in API level 21
open fun getFlags(): Int

Returns the flags of this LinkAddress.

getPrefixLength

Added in API level 21
open fun getPrefixLength(): Int

Returns the prefix length of this LinkAddress.

Return
Int Value is between 0 and 128 inclusive

getScope

Added in API level 21
open fun getScope(): Int

Returns the scope of this LinkAddress.

hashCode

Added in API level 21
open fun hashCode(): Int

Returns a hashcode for this address.

Return
Int a hash code value for this object.

toString

Added in API level 21
open fun toString(): String

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.

Return
String a string representation of the object.

writeToParcel

Added in API level 21
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Implement the Parcelable interface.

Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 21
static val CREATOR: Parcelable.Creator<LinkAddress!>

Implement the Parcelable interface.