Packages

class IPAddress extends AnyRef

Represents an IP address. This class is similar to java.net.InetAddress, but it's designed to be more intuitive and easier to use from Scala. This package provides implicit converters to make this class compatible with java.net.InetAddress. The converters ensure that all the (non-static) methods defined in the java.net.InetAddress class are directly callable from an instance of the Scala IPAddress class. For instance, the following code is perfectly legal:

val ip = IPAddress(192, 168, 2, 5)

// Test if the address is reachable within 1 second.
println(ip + " is reachable? " + ip.isReachable(1000))

// Get the canonical host name for (i.e., do a reverse lookup on) the
// address.
println(ip + " -> " + ip.getCanonicalHostName)

// Determine whether it's the loopback address.
println(ip + " == loopback? " + ip.isLoopbackAddress)

Here's an IPv6 example:

val ip = IPAddress("fe80::21d:9ff:fea7:53e3")

// Test if the address is reachable within 1 second.
println(ip + " is reachable? " + ip.isReachable(1000))

// Get the canonical host name for (i.e., do a reverse lookup on) the
// address.
println(ip + " -> " + ip.getCanonicalHostName)

// Determine whether it's the loopback address.
println(ip + " == loopback? " + ip.isLoopbackAddress)
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IPAddress
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new IPAddress(address: Array[Byte])

    address

    the IPv4 or IPv6 address, as bytes

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val address: Array[Byte]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(other: Any): Boolean

    Overloaded "==" method to test for equality.

    Overloaded "==" method to test for equality.

    other

    object against which to test this object

    returns

    true if equal, false if not

    Definition Classes
    IPAddress → AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int

    Overloaded hash method: Ensures that two IPAddress objects that represent the same IP address have the same hash code.

    Overloaded hash method: Ensures that two IPAddress objects that represent the same IP address have the same hash code.

    returns

    the hash code

    Definition Classes
    IPAddress → AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toInetAddress: InetAddress

    Convert this IPAddress to its corresponding java.net.InetAddress object.

    Convert this IPAddress to its corresponding java.net.InetAddress object. Note that you can _also_ use the implicit conversions provided by grizzled.net.Implicits.

    returns

    the corresponding InetAddress

  18. def toNumber: BigInt

    Convert the IP address to a number, suitable for numeric comparisons against other IP addresses.

    Convert the IP address to a number, suitable for numeric comparisons against other IP addresses. The number is returned as a BigInt to allow for both IPv4 and IPv6 addresses.

    returns

    the number

  19. val toString: String

    Return a printable version of this IP address.

    Return a printable version of this IP address.

    returns

    the printable version

    Definition Classes
    IPAddress → AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped