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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.
-
-
-
Method Detail
-
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
-
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
@Nonnull public static RecordCursorContinuation fromNullable(@Nullable byte[] bytes)
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
@Nonnull public static RecordCursorContinuation fromInt(int a)
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
-
-