Package com.apple.foundationdb.record
Class ByteArrayContinuation
java.lang.Object
com.apple.foundationdb.record.ByteArrayContinuation
- All Implemented Interfaces:
RecordCursorContinuation
@API(EXPERIMENTAL)
public class ByteArrayContinuation
extends Object
implements RecordCursorContinuation
A shim to wrap old-style byte array continuations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RecordCursorContinuation
fromInt
(int a) Return aRecordCursorContinuation
that wraps a byte array consisting of the given integer.static RecordCursorContinuation
fromNullable
(byte[] bytes) Return aRecordCursorContinuation
from a byte array.boolean
isEnd()
Return whether this continuation is an "end continuation", i.e., represents that the iteration has reached its end and would not produce more results even if restarted.byte[]
toBytes()
Serialize this continuation to a byte array.Serialize this continuation to a ByteString object.
-
Method Details
-
toBytes
@Nonnull public byte[] toBytes()Description copied from interface:RecordCursorContinuation
Serialize this continuation to a byte array. This method must always return the same array contents (but not necessarily the same array). IfRecordCursorContinuation.isEnd()
returnstrue
, thentoBytes()
must returnnull
.- Specified by:
toBytes
in interfaceRecordCursorContinuation
- Returns:
- a (possibly null) byte array containing a binary serialization of this continuation
-
toByteString
Description copied from interface:RecordCursorContinuation
Serialize this continuation to a ByteString object. IfRecordCursorContinuation.toBytes()
returns null, thentoByteString()
is supposed to return EMPTY.- Specified by:
toByteString
in interfaceRecordCursorContinuation
- Returns:
- a (possibly EMPTY) ByteString containing a binary serialization of this continuation
-
isEnd
public boolean isEnd()Description copied from interface:RecordCursorContinuation
Return whether this continuation is an "end continuation", i.e., represents that the iteration has reached its end and would not produce more results even if restarted. IfisEnd()
returnstrue
, thenRecordCursorContinuation.toBytes()
must returnnull
.- Specified by:
isEnd
in interfaceRecordCursorContinuation
- Returns:
- whether this continuation represents the end of a cursor's iteration
-
fromNullable
Return aRecordCursorContinuation
from a byte array. If the given byte array is non-null, return aByteArrayContinuation
wrapping that array. If the given byte array isnull
, return aRecordCursorEndContinuation
instead.- Parameters:
bytes
- a nullable byte array representing a serialized continuation- Returns:
- a
RecordCursorContinuation
as described above
-
fromInt
Return aRecordCursorContinuation
that wraps a byte array consisting of the given integer.- Parameters:
a
- an integer- Returns:
- a
ByteArrayContinuation
wrapping a byte array of the given integer
-