# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Inherited Constants | Fields | Methods | Inherited Methods

# IpPrefix

`public final class IpPrefix`
`extends Object` `implements Parcelable`

java.lang.Object
↳ | android.net.IpPrefix

This class represents an IP prefix, i.e., a contiguous block of IP addresses aligned on a power of two boundary (also known as an "IP subnet"). A prefix is specified by two pieces of information:

- A starting IP address (IPv4 or IPv6). This is the first IP address of the prefix.
- A prefix length. This specifies the length of the prefix by specifing the number of bits in the IP address, starting from the most significant bit in network byte order, that are constant for all addresses in the prefix.

For example, the prefix `192.0.2.0/24` covers the 256 IPv4 addresses from `192.0.2.0` to `192.0.2.255`, inclusive, and the prefix `2001:db8:1:2` covers the 2^64 IPv6 addresses from `2001:db8:1:2::` to `2001:db8:1:2:ffff:ffff:ffff:ffff`, inclusive. Objects of this class are immutable.

## Summary

### Inherited constants
From interface `android.os.Parcelable`
`int` | `CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` | `PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `writeToParcel(Parcel, int)`: 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 Creator<IpPrefix>` | `CREATOR` Implement the Parcelable interface.

### Public methods
`boolean` | `contains(InetAddress address)` Determines whether the prefix contains the specified address.
`int` | `describeContents()` Implement the Parcelable interface.
`boolean` | `equals(Object obj)` Compares this `IpPrefix` object against the specified object in `obj`.
`InetAddress` | `getAddress()` Returns a copy of the first IP address in the prefix.
`int` | `getPrefixLength()` Returns the prefix length of this `IpPrefix`.
`byte[]` | `getRawAddress()` Returns a copy of the IP address bytes in network order (the highest order byte is the zeroth element).
`int` | `hashCode()` Gets the hashcode of the represented IP prefix.
`String` | `toString()` Returns a string representation of this `IpPrefix`.
`void` | `writeToParcel(Parcel dest, int flags)` Implement the Parcelable interface.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.os.Parcelable`
`abstract int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`abstract void` | `writeToParcel(Parcel dest, int flags)` Flatten this object in to a Parcel.

## Fields

### CREATOR

    public static final Creator<IpPrefix> CREATOR

Implement the Parcelable interface.

## Public methods

### contains

    public boolean contains (InetAddress address)

Determines whether the prefix contains the specified address.

Parameters
`address` | `InetAddress`: An `InetAddress` to test. This value cannot be `null`.

Returns
`boolean` | `true` if the prefix covers the given address. `false` otherwise.

### describeContents

    public int describeContents ()

Implement the Parcelable interface.

Returns
`int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or `CONTENTS_FILE_DESCRIPTOR`

### equals

    public boolean equals (Object obj)

Compares this `IpPrefix` object against the specified object in `obj`. Two objects are equal if they have the same startAddress and prefixLength.

Parameters
`obj` | `Object`: the object to be tested for equality. This value may be `null`.

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

### getAddress

    public InetAddress getAddress ()

Returns a copy of the first IP address in the prefix. Modifying the returned object does not change this object's contents.

Returns
`InetAddress` | the address in the form of a byte array. This value cannot be `null`.

### getPrefixLength

    public int getPrefixLength ()

Returns the prefix length of this `IpPrefix`.

Returns
`int` | the prefix length. Value is between 0 and 128 inclusive

### getRawAddress

    public byte[] getRawAddress ()

Returns a copy of the IP address bytes in network order (the highest order byte is the zeroth element). Modifying the returned array does not change this object's contents.

Returns
`byte[]` | the address in the form of a byte array. This value cannot be `null`.

### hashCode

    public int hashCode ()

Gets the hashcode of the represented IP prefix.

Returns
`int` | the appropriate hashcode value.

### toString

    public String toString ()

Returns a string representation of this `IpPrefix`.

Returns
`String` | a string such as `"192.0.2.0/24"` or `"2001:db8:1:2::/64"`.

### writeToParcel

    public 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.PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*