public final class BinaryToken extends Object implements ScalarToken, Comparable<BinaryToken>
BinaryValued object.| Modifier and Type | Field and Description |
|---|---|
static BinaryToken |
NULL
A null valued
BinaryToken |
static BinaryToken |
ZERO
A zero valued
BinaryToken |
static byte[] |
ZERO_VALUE
The byte array representing a zero value, the empty
byte[]. |
| Constructor and Description |
|---|
BinaryToken(BinaryValued value)
Constructs a new token with the binary
value in the given container.
|
BinaryToken(byte[] value)
Constructs a new token with the given
non-null binary value.
|
BinaryToken(String value)
Constructs a
BinaryToken with the non-null
binary value encoded by the given hexadecimal string. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asBinary()
Gets the contained binary value.
|
byte[] |
asBinaryRef()
Gets a reference to the contained binary value.
|
int |
compareTo(BinaryToken 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 BinaryToken |
parse(String value)
Converts a string representation of a binary value into
a token.
|
boolean |
represents(byte[] otherData)
A 'deep equals' comparison of this token's contents to the provided raw bytes.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetType, isZeroisNullpublic static final BinaryToken NULL
BinaryTokenpublic static final byte[] ZERO_VALUE
byte[].public static final BinaryToken ZERO
BinaryTokenpublic BinaryToken(BinaryValued value)
value - a BinaryValued containing the
desired valuepublic BinaryToken(byte[] value)
NULL.value - the binary value of the token. A copy
of the array will be made.NullPointerException - if the supplied array
is nullpublic BinaryToken(String value)
BinaryToken with the non-null
binary value encoded by the given hexadecimal string.
If a null valued token is desired, use NULL.value - a hexadecimal string representing the
binary valueNullPointerException - if the supplied hexadecimal
string is nullpublic int compareTo(BinaryToken that)
compareTo in interface Comparable<BinaryToken>public boolean equals(Object obj)
DataTokenTokenComparator.equal(TokenValued,TokenValued)
but makes it possible to store DataTokens in Maps.public boolean represents(byte[] otherData)
otherData - the object that we're comparing topublic int hashCode()
DataTokenTokenConverter.asHashCode(TokenValued).public static BinaryToken parse(String value)
value - a hexadecimal string representing a binary valuepublic final ScalarTokenType getType()
TokenValuedgetType in interface ScalarValuedgetType in interface TokenValuedgetType in interface ScalarTypedgetType in interface TokenTypedpublic final byte[] asBinary()
BinaryValued
The array returned is a copy of the binary data contained in
the object. To avoid this overhead, use BinaryValued.asBinaryRef()
instead.
asBinary in interface BinaryValuedbyte[]. If
null valued, as indicated by TokenValued.isNull(),
null is returned.public final byte[] asBinaryRef()
BinaryValued
While this call avoids the overhead seen with BinaryValued.asBinary(),
the caller must guarantee that the returned array will not be
modified. Failure to comply may result in the dataflow exhibiting
unexpected behavior, as other operators may (or may not)
see the modified value.
asBinaryRef in interface BinaryValuedbyte[] holding the contained
value. If null valued, as indicated by TokenValued.isNull(),
null is returned.public final boolean isZero()
ScalarValuedisZero in interface ScalarValuedtrue if the value is the zero value,
false otherwise.public final boolean isNull()
TokenValuedisNull in interface TokenValuedtrue if the token is null valued,
false otherwiseCopyright © 2019 Actian Corporation. All rights reserved.