public short sizeInBytes() {
    switch (version) {
      case BLOB_ID_V1:
        return (short) (VERSION_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES
            + getUuid().getBytes().length);
      case BLOB_ID_V2:
      case BLOB_ID_V3:
      case BLOB_ID_V4:
      case BLOB_ID_V5:
        return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES
            + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length
            + UUID_SIZE_FIELD_LENGTH_IN_BYTES + getUuid().getBytes().length);
      case BLOB_ID_V6:
        return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES
            + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length
            + UuidSerDe.SIZE_IN_BYTES);
      default:
        throw new IllegalArgumentException("blobId version=" + version + " not supported");
    }
  }
Size of blobId when it is serialized into bytes.
@return The byte count of the serialized blobId.
ambry-commons/src/main/java/com/github/ambry/commons/BlobId.java