Ipv4Address

final
class Ipv4Address extends IpAddress with Ipv4AddressPlatform

Representation of an IPv4 address that works on both the JVM and Scala.js.

Companion
object
trait Ipv4AddressPlatform
class IpAddress
trait Serializable
trait Host
trait Ordered[Host]
trait Comparable[Host]
trait HostPlatform
trait IpAddressPlatform
class Object
trait Matchable
class Any

Value members

Concrete methods

override
def fold[A](v4: Ipv4Address => A, v6: Ipv6Address => A): A
Definition Classes
override
def isMulticast: Boolean
Definition Classes
override
Definition Classes

Applies the supplied mask to this address.

Applies the supplied mask to this address.

Example
scala> ipv4"192.168.29.1".masked(ipv4"255.255.0.0") res0: Ipv4Address = 192.168.0.0

Computes the last address in the network identified by applying the supplied mask to this address.

Computes the last address in the network identified by applying the supplied mask to this address.

Example
scala> ipv4"192.168.29.1".maskedLast(ipv4"255.255.0.0") res0: Ipv4Address = 192.168.255.255
override

Gets the IPv4 address after this address, with overflow from 255.255.255.255 to 0.0.0.0.

Gets the IPv4 address after this address, with overflow from 255.255.255.255 to 0.0.0.0.

Definition Classes
override

Gets the IPv4 address before this address, with underflow from 0.0.0.0 to 255.255.255.255.

Gets the IPv4 address before this address, with underflow from 0.0.0.0 to 255.255.255.255.

Definition Classes

Converts this V4 address to a compat V6 address, where the first 12 bytes are all zero and the last 4 bytes contain the bytes of this V4 address.

Converts this V4 address to a compat V6 address, where the first 12 bytes are all zero and the last 4 bytes contain the bytes of this V4 address.

def toLong: Long

Converts this address to a 32-bit unsigned integer.

Converts this address to a 32-bit unsigned integer.

Converts this V4 address to a mapped V6 address, where the first 10 bytes are all zero, the next two bytes are ff, and the last 4 bytes contain the bytes of this V4 address.

Converts this V4 address to a mapped V6 address, where the first 10 bytes are all zero, the next two bytes are ff, and the last 4 bytes contain the bytes of this V4 address.

override
def toString: String

Returns the dotted decimal representation of this address.

Returns the dotted decimal representation of this address.

Definition Classes
Any
override
def toUriString: String
Definition Classes
Definition Classes

Inherited methods

def /(prefixBits: Int): Cidr[Ipv4Address]

Constructs a Cidr address from this address.

Constructs a Cidr address from this address.

Inherited from
IpAddress
def <(that: Host): Boolean
Inherited from
Ordered
def <=(that: Host): Boolean
Inherited from
Ordered
def >(that: Host): Boolean
Inherited from
Ordered
def >=(that: Host): Boolean
Inherited from
Ordered
def asIpv4: Option[Ipv4Address]

Narrows this address to an Ipv4Address if that is the underlying type.

Narrows this address to an Ipv4Address if that is the underlying type.

Inherited from
IpAddress
def asIpv6: Option[Ipv6Address]

Narrows this address to an Ipv6Address if that is the underlying type.

Narrows this address to an Ipv6Address if that is the underlying type.

Inherited from
IpAddress

Converts this address to a multicast address, as long as it is in the multicast address range.

Converts this address to a multicast address, as long as it is in the multicast address range.

Inherited from
IpAddress

Converts this address to a source specific multicast address, as long as it is in the source specific multicast address range.

Converts this address to a source specific multicast address, as long as it is in the source specific multicast address range.

Inherited from
IpAddress

If this address is an IPv4 mapped IPv6 address, converts to an IPv4 address, otherwise returns this.

If this address is an IPv4 mapped IPv6 address, converts to an IPv4 address, otherwise returns this.

Inherited from
IpAddress
def compare(that: Host): Int
Inherited from
Host
def compareTo(that: Host): Int
Inherited from
Ordered
override
def equals(other: Any): Boolean
Definition Classes
IpAddress -> Any
Inherited from
IpAddress
override
def hashCode: Int
Definition Classes
IpAddress -> Any
Inherited from
IpAddress
def isMappedV4: Boolean

Returns true if this address is a V6 address containing a mapped V4 address.

Returns true if this address is a V6 address containing a mapped V4 address.

Inherited from
IpAddress
def resolve[F[_] : Applicative]: F[IpAddress]

Resolves this host to an ip address using the platform DNS resolver.

Resolves this host to an ip address using the platform DNS resolver.

If the host cannot be resolved, the effect fails with a java.net.UnknownHostException.

Inherited from
HostPlatform
def resolveAll[F[_] : Applicative]: F[List[IpAddress]]

Resolves this host to all ip addresses known to the platform DNS resolver.

Resolves this host to all ip addresses known to the platform DNS resolver.

If the host cannot be resolved, an empty list is returned.

Inherited from
HostPlatform
def resolveOption[F[_] : ApplicativeThrow]: F[Option[IpAddress]]

Resolves this host to an ip address using the platform DNS resolver.

Resolves this host to an ip address using the platform DNS resolver.

If the host cannot be resolved, a None is returned.

Inherited from
HostPlatform
def toBytes: Array[Byte]

Converts this address to a network order byte array of either 4 or 16 bytes.

Converts this address to a network order byte array of either 4 or 16 bytes.

Inherited from
IpAddress
override
def toInetAddress: Inet4Address
Definition Classes
Ipv4AddressPlatform -> IpAddressPlatform
Inherited from
Ipv4AddressPlatform

Returns the version of this address.

Returns the version of this address.

Inherited from
IpAddress