Google Cloud Dataflow SDK for Java, version 1.9.1
Class ByteKey
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.io.range.ByteKey
-
- All Implemented Interfaces:
- Serializable, Comparable<ByteKey>
public final class ByteKey extends Object implements Comparable<ByteKey>, Serializable
A class representing a key consisting of an array of bytes. Arbitrary-lengthbyte[]
keys are typical in key-value stores such as Google Cloud Bigtable.Instances of
ByteKey
are immutable.ByteKey
implementsComparable<ByteKey>
by comparing the arrays in lexicographic order. The smallestByteKey
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 emptyByteKey
is used as an upper bound, it represents the largest possible key. In these cases, implementors should useisEmpty()
to test whether an upper bound key is empty.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
compareTo(ByteKey other)
ByteKey
implementsComparable<ByteKey>
by comparing the arrays in lexicographic order.static ByteKey
copyFrom(byte[] bytes)
Creates a newByteKey
backed by a copy of the specifiedbyte[]
.boolean
equals(Object o)
byte[]
getBytes()
Returns a newly-allocatedbyte[]
representing thisByteKey
.com.google.protobuf.ByteString
getValue()
Returns an immutableByteString
representing thisByteKey
.int
hashCode()
boolean
isEmpty()
static ByteKey
of(com.google.protobuf.ByteString value)
Creates a newByteKey
backed by the specifiedByteString
.static ByteKey
of(int... bytes)
Creates a newByteKey
backed by a copy of the specifiedint[]
.String
toString()
-
-
-
Field Detail
-
EMPTY
public static final ByteKey EMPTY
An empty key.
-
-
Method Detail
-
of
public static ByteKey of(com.google.protobuf.ByteString value)
Creates a newByteKey
backed by the specifiedByteString
.
-
copyFrom
public static ByteKey copyFrom(byte[] bytes)
Creates a newByteKey
backed by a copy of the specifiedbyte[]
.Makes a copy of the underlying array.
-
of
public static ByteKey of(int... bytes)
-
getValue
public com.google.protobuf.ByteString getValue()
-
getBytes
public byte[] getBytes()
-
isEmpty
public boolean isEmpty()
-
compareTo
public int compareTo(ByteKey other)
ByteKey
implementsComparable<ByteKey>
by comparing the arrays in lexicographic order. The smallestByteKey
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.- Specified by:
compareTo
in interfaceComparable<ByteKey>
-
-