Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/net/LinkAddress#inhconstants) \| [Fields](https://developer.android.com/reference/android/net/LinkAddress#lfields) \| [Methods](https://developer.android.com/reference/android/net/LinkAddress#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/LinkAddress#inhmethods)

# LinkAddress

*** ** * ** ***

` public class LinkAddress `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.LinkAddress |

<br />

*** ** * ** ***

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`).

<br />

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/net/LinkAddress>` | `https://developer.android.com/reference/android/net/LinkAddress#CREATOR` Implement the Parcelable interface. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/net/LinkAddress#describeContents()() ` Implement the Parcelable interface. |
| ` boolean` | ` https://developer.android.com/reference/android/net/LinkAddress#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Compares this `LinkAddress` instance against `obj`. |
| ` https://developer.android.com/reference/java/net/InetAddress` | ` https://developer.android.com/reference/android/net/LinkAddress#getAddress()() ` Returns the `https://developer.android.com/reference/java/net/InetAddress` of this `LinkAddress`. |
| ` int` | ` https://developer.android.com/reference/android/net/LinkAddress#getFlags()() ` Returns the flags of this `LinkAddress`. |
| ` int` | ` https://developer.android.com/reference/android/net/LinkAddress#getPrefixLength()() ` Returns the prefix length of this `LinkAddress`. |
| ` int` | ` https://developer.android.com/reference/android/net/LinkAddress#getScope()() ` Returns the scope of this `LinkAddress`. |
| ` int` | ` https://developer.android.com/reference/android/net/LinkAddress#hashCode()() ` Returns a hashcode for this address. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/LinkAddress#toString()() ` Returns a string representation of this address, such as "192.0.2.1/24" or "2001:db8::1/64". |
| ` void` | ` https://developer.android.com/reference/android/net/LinkAddress#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Implement the Parcelable interface. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Fields

### CREATOR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<LinkAddress> CREATOR
```

Implement the Parcelable interface.

<br />

## Public methods

### describeContents

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Implement the Parcelable interface.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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.

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: the object to be tested for equality. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if both objects are equal, `false` otherwise. <br /> |

### getAddress

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InetAddress getAddress ()
```

Returns the `https://developer.android.com/reference/java/net/InetAddress` of this `LinkAddress`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/net/InetAddress` | <br /> |

### getFlags

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getFlags ()
```

Returns the flags of this `LinkAddress`.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getPrefixLength

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPrefixLength ()
```

Returns the prefix length of this `LinkAddress`.

<br />

| Returns ||
|---|---|
| `int` | Value is between 0 and 128 inclusive <br /> |

### getScope

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getScope ()
```

Returns the scope of this `LinkAddress`.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### hashCode

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hashcode for this address.

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### toString

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Implement the Parcelable interface.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |