@Override
  public byte[] toBytes() {
    byte[] buf;
    switch (version) {
      case VERSION_0:
        int size = 2 * Short.BYTES + 2 * Long.BYTES + Short.BYTES;
        for (String blobId : lastUpdateTimeReadBlobIds) {
          size += Short.BYTES; //for size of string
          size += blobId.length(); //for the string itself
        }
        buf = new byte[size];
        ByteBuffer bufWrap = ByteBuffer.wrap(buf);
        // add version
        bufWrap.putShort(version);
        // add type
        bufWrap.putShort((short) type.ordinal());
        // add latestUploadTime
        bufWrap.putLong(lastUpdateTime);
        // add bytesRead
        bufWrap.putLong(bytesRead);
        // add lastUpdateTimeReadBlobIds
        bufWrap.putShort((short) lastUpdateTimeReadBlobIds.size());
        for (String blobId : lastUpdateTimeReadBlobIds) {
          bufWrap.putShort((short) blobId.length());
          bufWrap.put(blobId.getBytes());
        }
        break;
      default:
        throw new IllegalStateException("Unknown version: " + version);
    }
    return buf;
  }
Utility to construct a new CloudFindToken from a previous instance and the results of a findEntriesSince query.
@param prevToken previous {@link CosmosUpdateTimeFindToken}.
@param queryResults List of {@link CloudBlobMetadata} objects.
@return the updated token.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosUpdateTimeFindToken.java