public final class Ip4AddressToken extends Object implements ScalarToken, Comparable<Ip4AddressToken>
Ip4AddressValued
object.Modifier and Type | Field and Description |
---|---|
static Ip4AddressToken |
NULL
A null valued
Ip4AddressToken |
static Ip4AddressToken |
ZERO
A zero valued
Ip4AddressToken |
static byte[] |
ZERO_VALUE
The byte array representing the 0.0.0.0 ip address, the empty
byte[4] . |
Constructor and Description |
---|
Ip4AddressToken(byte[] value)
Constructs a new token with the given
non-null ip4 value.
|
Ip4AddressToken(Ip4AddressValued value)
Constructs a new token with the ip4 address
value in the given container.
|
Ip4AddressToken(String value)
Constructs a
Ip4AddressToken with the non-null
ip4 address value encoded by the given string. |
Modifier and Type | Method and Description |
---|---|
byte[] |
asAddress()
Gets the contained raw IPv4 address value.
|
Inet4Address |
asInet4Address()
Gets the contained IP address as an Inet4Address.
|
int |
compareTo(Ip4AddressToken that) |
boolean |
equals(Object obj)
Indicates whether another object is equal to this token.
|
ScalarTokenType |
getType()
Gets the data type of the token.
|
int |
hashCode()
Returns a hash code for the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isZero()
Indicates whether the value is the zero value
for the type.
|
static Ip4AddressToken |
parse(String value)
Converts a string representation of a ip4 address value into
a token.
|
boolean |
represents(byte[] otherData)
A 'deep equals' comparison of this token's contents to the provided raw ip4 bytes.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getType, isZero
isNull
public static final Ip4AddressToken NULL
Ip4AddressToken
public static final byte[] ZERO_VALUE
byte[4]
.public static final Ip4AddressToken ZERO
Ip4AddressToken
public Ip4AddressToken(Ip4AddressValued value)
value
- a Ip4AddressValued
containing the
desired valuepublic Ip4AddressToken(byte[] value)
NULL
.value
- the ip4 address value of the token.
A copy of the array will be made.NullPointerException
- if the supplied array
is null
public Ip4AddressToken(String value)
Ip4AddressToken
with the non-null
ip4 address value encoded by the given string.
Should be in form #.#.#.#
If a null valued token is desired, use NULL
.value
- a string representing the ip4 valueNullPointerException
- if the supplied hexadecimal
string is null
public int compareTo(Ip4AddressToken that)
compareTo
in interface Comparable<Ip4AddressToken>
public boolean equals(Object obj)
DataToken
TokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataToken
s in Map
s.public boolean represents(byte[] otherData)
otherData
- the object that we're comparing topublic int hashCode()
DataToken
TokenConverter.asHashCode(TokenValued)
.public static Ip4AddressToken parse(String value)
value
- a string representing an ip4 addresspublic final ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public final byte[] asAddress()
Ip4AddressValued
asAddress
in interface Ip4AddressValued
byte[4]
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public final Inet4Address asInet4Address()
Ip4AddressValued
asInet4Address
in interface Ip4AddressValued
Inet4Address
. If null valued,
as indicated by TokenValued.isNull()
, null
is returned.public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public final boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwiseCopyright © 2019 Actian Corporation. All rights reserved.