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 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). If RecordCursorContinuation.isEnd() returns true, then toBytes() must return null.
      Specified by:
      toBytes in interface RecordCursorContinuation
      Returns:
      a (possibly null) byte array containing a binary serialization of this continuation
    • toByteString

      @Nonnull public ByteString toByteString()
      Description copied from interface: RecordCursorContinuation
      Serialize this continuation to a ByteString object. If RecordCursorContinuation.toBytes() returns null, then toByteString() is supposed to return EMPTY.
      Specified by:
      toByteString in interface RecordCursorContinuation
      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. If isEnd() returns true, then RecordCursorContinuation.toBytes() must return null.
      Specified by:
      isEnd in interface RecordCursorContinuation
      Returns:
      whether this continuation represents the end of a cursor's iteration
    • fromNullable

      @Nonnull public static RecordCursorContinuation fromNullable(@Nullable byte[] bytes)
      Return a RecordCursorContinuation from a byte array. If the given byte array is non-null, return a ByteArrayContinuation wrapping that array. If the given byte array is null, return a RecordCursorEndContinuation 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 a RecordCursorContinuation 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