Package org.apache.beam.sdk.io.range
Class ByteKey
java.lang.Object
org.apache.beam.sdk.io.range.ByteKey
- All Implemented Interfaces:
Serializable,Comparable<ByteKey>
A class representing a key consisting of an array of bytes. Arbitrary-length
byte[] keys
are typical in key-value stores such as Google Cloud Bigtable.
Instances of ByteKey are immutable.
ByteKey implements Comparable<ByteKey> by comparing the
arrays in lexicographic order. The smallest ByteKey is a zero-length array; the successor
to a key is the same key with an additional 0 byte appended; and keys have unbounded size.
Note that the empty ByteKey compares smaller than all other keys, but some systems
have the semantic that when an empty ByteKey is used as an upper bound, it represents the
largest possible key. In these cases, implementors should use isEmpty() to test whether an
upper bound key is empty.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintByteKeyimplementsComparable<ByteKey>by comparing the arrays in lexicographic order.static ByteKeycopyFrom(byte[] bytes) Creates a newByteKeybacked by a copy of the specifiedbyte[].static ByteKeycopyFrom(ByteBuffer value) Creates a newByteKeybacked by a copy of the data remaining in the specifiedByteBuffer.booleanbyte[]getBytes()Returns a newly-allocatedbyte[]representing thisByteKey.getValue()Returns a read-onlyByteBufferrepresenting thisByteKey.inthashCode()booleanisEmpty()static ByteKeyof(int... bytes) Creates a newByteKeybacked by a copy of the specifiedint[].toString()
-
Field Details
-
EMPTY
An empty key.
-
-
Method Details
-
copyFrom
Creates a newByteKeybacked by a copy of the data remaining in the specifiedByteBuffer. -
copyFrom
Creates a newByteKeybacked by a copy of the specifiedbyte[].Makes a copy of the underlying array.
-
of
-
getValue
Returns a read-onlyByteBufferrepresenting thisByteKey. -
getBytes
public byte[] getBytes() -
isEmpty
public boolean isEmpty() -
compareTo
ByteKeyimplementsComparable<ByteKey>by comparing the arrays in lexicographic order. The smallestByteKeyis a zero-length array; the successor to a key is the same key with an additional 0 byte appended; and keys have unbounded size.- Specified by:
compareToin interfaceComparable<ByteKey>
-
toString
-
equals
-
hashCode
public int hashCode()
-