public final class IndexValue extends Object implements Externalizable
IndexCollection
and used to query the
StateServer for objects with metadata matching the IndexCollection
.Modifier and Type | Field and Description |
---|---|
static int |
MaxValueByteLength |
Constructor and Description |
---|
IndexValue(boolean value)
Create a new
IndexValue using the contents of value exported as a byte
array. |
IndexValue(byte[] value)
Create a new
IndexValue with the value given in value. |
IndexValue(byte[] value,
int position,
int length)
Create a new
IndexValue with the values given in positions position
(inclusive) through position + length (exclusive) of the array value. |
IndexValue(Date value)
Create a new
IndexValue using the contents of value exported as a byte
array. |
IndexValue(int value)
Create a new
IndexValue using the contents of value exported as a byte
array. |
IndexValue(long value)
Create a new
IndexValue using the contents of value exported as a byte
array. |
IndexValue(String value)
Create a new
IndexValue using the 32-byte digest resulting from the SHA-256
MessageDigest of value. |
IndexValue(UUID value)
Create a new
IndexValue using the contents of value exported as a byte
array. |
Modifier and Type | Method and Description |
---|---|
void |
CopyTo(byte[] dest,
int index)
Copies the contents of this
IndexValue to the specified byte array beginning at
the specified index. |
static IndexValue |
deserialize(ObjectInput in)
Create a new
IndexValue instance from the serialized stream given by in. |
boolean |
equals(Object obj) |
byte[] |
getBytes()
Returns a copy of the current value of this
IndexValue as an array of bytes. |
int |
hashCode() |
void |
readExternal(ObjectInput in) |
void |
writeExternal(ObjectOutput out) |
public static final int MaxValueByteLength
public IndexValue(boolean value)
IndexValue
using the contents of value exported as a byte
array.value
- the value from which the IndexValue
is created.public IndexValue(Date value)
IndexValue
using the contents of value exported as a byte
array.value
- the value from which the IndexValue
is created.public IndexValue(UUID value)
IndexValue
using the contents of value exported as a byte
array.value
- the value from which the IndexValue
is created.public IndexValue(int value)
IndexValue
using the contents of value exported as a byte
array.value
- the value from which the IndexValue
is created.public IndexValue(long value)
IndexValue
using the contents of value exported as a byte
array.value
- the value from which the IndexValue
is created.public IndexValue(String value)
IndexValue
using the 32-byte digest resulting from the SHA-256
MessageDigest
of value.value
- the value from which the IndexValue
is created.public IndexValue(byte[] value)
IndexValue
with the value given in value. Note that
StateServer does not differentiate IndexValue
s based on the length of the index value:
IndexValue
s are always padded with zeros so that the IndexValue
is a full
MaxValueByteLength
in length.value
- a byte array that is first cloned and then the clone is used to initialize the
new IndexValue
. The length of value must be less than or equal
to MaxValueByteLength
.NullPointerException
- if value is null.IllegalArgumentException
- if value.length > MaxValueByteLength
.public IndexValue(byte[] value, int position, int length)
IndexValue
with the values given in positions position
(inclusive) through position + length (exclusive) of the array value.
Note that StateServer does not differentiate IndexValue
s based on the length of the
index value: IndexValue
s are always padded with zeros so that the IndexValue
is a full
MaxValueByteLength
in length.value
- a byte array from which bytes are copied to initialize the new IndexValue
.position
- the starting position within value from which bytes are copiedlength
- the number of bytes to copy. length must be less or equal to
MaxValueByteLength
.NullPointerException
- if value is null.IllegalArgumentException
- if length > MaxValueByteLength
.public void CopyTo(byte[] dest, int index)
IndexValue
to the specified byte array beginning at
the specified index.dest
- the destination byte arrayindex
- the index at which copying beginsIndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if dest is null
.public byte[] getBytes()
IndexValue
as an array of bytes.IndexValue
as an array of bytes.public static IndexValue deserialize(ObjectInput in) throws IOException
IndexValue
instance from the serialized stream given by in.in
- an ObjectInput
stream containing the bytes previously serialized via
writeExternal(ObjectOutput)
IndexValue
instance initialized from the streamIOException
- if there are issues accessing the ObjectInput
streampublic void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright (C) 2007-2014 ScaleOut Software, Inc.