public static CosmosChangeFeedFindToken fromBytes(DataInputStream inputStream) throws IOException {
    DataInputStream stream = new DataInputStream(inputStream);
    short version = stream.readShort();
    switch (version) {
      case VERSION_0:
        FindTokenType type = FindTokenType.values()[stream.readShort()];
        if (type != FindTokenType.CloudBased) {
          throw new IllegalArgumentException(
              String.format("Invalid token type %s found while deserialization. Expected %s.", type,
                  FindTokenType.CloudBased));
        }
        long bytesRead = stream.readLong();
        String startContinuationToken = readIntString(inputStream);
        String endContinuationToken = readIntString(inputStream);
        int index = inputStream.readInt();
        int totalItems = inputStream.readInt();
        String cacheSessionId = readIntString(inputStream);
        return new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
            cacheSessionId, version);
      default:
        throw new IllegalStateException("Unknown version of cloud token: " + version);
    }
  }
Deserialize {@link CosmosChangeFeedFindToken} object from input stream.
@param inputStream {@link DataOutputStream} to deserialize from.
@return {@link CosmosChangeFeedFindToken} object.
@throws IOException
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosChangeFeedFindToken.java