Class/Object

com.comcast.ip4s

IpAddress

Related Docs: object IpAddress | package ip4s

Permalink

sealed abstract class IpAddress extends IpAddressPlatform with Serializable

Immutable and safe representation of an IP address, either V4 or V6.

Construction

IpAddress instances are constructed in a few different ways: - via IpAddress("127.0.0.1"), which parses a string representation of the IP and returns an Option[IpAddress] - via IpAddress.fromBytes(arr), which returns an IP address if the supplied array is either exactly 4 bytes or exactly 16 bytes - via literal syntax like ip"127.0.0.1", which returns an IpAddress and fails to *compile* if the IP is invalid.

Type Hierarchy

There are two subtypes of IpAddress -- Ipv4Address and Ipv6Address. Each of these subtypes have a richer API than IpAddress and it is often useful to use those types directly, for example if your use case requires a V6 address. It is safe to pattern match on IpAddress to access Ipv4Address or Ipv6Address directly, or alternatively, you can use fold.

JVM Specific API

If using IpAddress on the JVM, you can call toInetAddress to convert the address to a java.net.InetAddress, for use with networking libraries. This method does not exist on the Scala.js version.

Source
IpAddress.scala
Linear Supertypes
Serializable, Serializable, IpAddressPlatform, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IpAddress
  2. Serializable
  3. Serializable
  4. IpAddressPlatform
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val bytes: Array[Byte]

    Permalink
    Attributes
    protected
  2. abstract def fold[A](v4: (Ipv4Address) ⇒ A, v6: (Ipv6Address) ⇒ A): A

    Permalink

    Converts this address to a value of type A using the supplied functions.

  3. abstract def isMulticast: Boolean

    Permalink

    Returns true if this address is in the multicast range.

  4. abstract def isSourceSpecificMulticast: Boolean

    Permalink

    Returns true if this address is in the source specific multicast range.

  5. abstract def next: IpAddress

    Permalink

    Gets the IP address after this address, with overflow from the maximum value to the minimum value.

  6. abstract def previous: IpAddress

    Permalink

    Gets the IP address before this address, with underflow from minimum value to the maximum value.

  7. abstract def toUriString: String

    Permalink

    Converts this address to a string form that is compatible for use in a URI per RFC3986 (namely, IPv6 addresses are rendered in condensed form and surrounded by brackets).

  8. abstract def transform(v4: (Ipv4Address) ⇒ Ipv4Address, v6: (Ipv6Address) ⇒ Ipv6Address): IpAddress.this.type

    Permalink

    Maps a type-preserving function across this IP address.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to any2stringadd[IpAddress] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (IpAddress, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to ArrowAssoc[IpAddress] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. def /(prefixBits: Int): Cidr[IpAddress.this.type]

    Permalink

    Constructs a Cidr address from this address.

  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def asIpv4: Option[Ipv4Address]

    Permalink

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

  9. def asIpv6: Option[Ipv6Address]

    Permalink

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

  10. def asMulticast: Option[Multicast[IpAddress.this.type]]

    Permalink

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

  11. def asSourceSpecificMulticast: Option[SourceSpecificMulticast[IpAddress.this.type]]

    Permalink

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

  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def ensuring(cond: (IpAddress) ⇒ Boolean, msg: ⇒ Any): IpAddress

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to Ensuring[IpAddress] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (IpAddress) ⇒ Boolean): IpAddress

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to Ensuring[IpAddress] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: ⇒ Any): IpAddress

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to Ensuring[IpAddress] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): IpAddress

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to Ensuring[IpAddress] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    IpAddress → AnyRef → Any
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to StringFormat[IpAddress] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    IpAddress → AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toBytes: Array[Byte]

    Permalink

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

  29. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. def [B](y: B): (IpAddress, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from IpAddress to ArrowAssoc[IpAddress] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from Serializable

Inherited from IpAddressPlatform

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from IpAddress to any2stringadd[IpAddress]

Inherited by implicit conversion StringFormat from IpAddress to StringFormat[IpAddress]

Inherited by implicit conversion Ensuring from IpAddress to Ensuring[IpAddress]

Inherited by implicit conversion ArrowAssoc from IpAddress to ArrowAssoc[IpAddress]

Ungrouped