grizzled.net

IPAddress

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. Hide All
  2. Show all
  1. IPAddress
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Instance Constructors

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

    address

    the IPv4 or IPv6 address, as bytes

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. val address : Array[Byte]

    the IPv4 or IPv6 address, as bytes

  7. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  8. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  10. 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
  11. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  13. 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
  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  16. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  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. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any