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 RecordCursorContinuationfromInt(int a) Return aRecordCursorContinuationthat wraps a byte array consisting of the given integer.static RecordCursorContinuationfromNullable(byte[] bytes) Return aRecordCursorContinuationfrom a byte array.booleanisEnd()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:RecordCursorContinuationSerialize 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:
toBytesin interfaceRecordCursorContinuation- Returns:
- a (possibly null) byte array containing a binary serialization of this continuation
-
toByteString
Description copied from interface:RecordCursorContinuationSerialize this continuation to a ByteString object. IfRecordCursorContinuation.toBytes()returns null, thentoByteString()is supposed to return EMPTY.- Specified by:
toByteStringin interfaceRecordCursorContinuation- Returns:
- a (possibly EMPTY) ByteString containing a binary serialization of this continuation
-
isEnd
public boolean isEnd()Description copied from interface:RecordCursorContinuationReturn 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:
isEndin interfaceRecordCursorContinuation- Returns:
- whether this continuation represents the end of a cursor's iteration
-
fromNullable
Return aRecordCursorContinuationfrom a byte array. If the given byte array is non-null, return aByteArrayContinuationwrapping that array. If the given byte array isnull, return aRecordCursorEndContinuationinstead.- Parameters:
bytes- a nullable byte array representing a serialized continuation- Returns:
- a
RecordCursorContinuationas described above
-
fromInt
Return aRecordCursorContinuationthat wraps a byte array consisting of the given integer.- Parameters:
a- an integer- Returns:
- a
ByteArrayContinuationwrapping a byte array of the given integer
-