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)
- Alphabetic
- By Inheritance
- IPAddress
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new IPAddress(address: Array[Byte])
- address
the IPv4 or IPv6 address, as bytes
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val address: Array[Byte]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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
trueif equal,falseif not
- Definition Classes
- IPAddress → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
Overloaded hash method: Ensures that two
IPAddressobjects that represent the same IP address have the same hash code.Overloaded hash method: Ensures that two
IPAddressobjects that represent the same IP address have the same hash code.- returns
the hash code
- Definition Classes
- IPAddress → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toInetAddress: InetAddress
Convert this
IPAddressto its correspondingjava.net.InetAddressobject.Convert this
IPAddressto its correspondingjava.net.InetAddressobject. Note that you can _also_ use the implicit conversions provided bygrizzled.net.Implicits.- returns
the corresponding
InetAddress
- 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
BigIntto allow for both IPv4 and IPv6 addresses.- returns
the number
- 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
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()