public static BatchDeleteResponse readFrom(DataInputStream stream, ClusterMap clusterMap) throws IOException {
    RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()];
    if (type != RequestOrResponseType.BatchDeleteResponse) {
      throw new IllegalArgumentException("The type of request response is not compatible");
    }
    Short versionId = stream.readShort();
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    ServerErrorCode error = ServerErrorCode.values()[stream.readShort()];

    int partitionResponseInfoCount = stream.readInt();
    ArrayList<BatchDeletePartitionResponseInfo> partitionResponseInfoList = new ArrayList<>(partitionResponseInfoCount);
    for (int i = 0; i < partitionResponseInfoCount; i++) {
      BatchDeletePartitionResponseInfo partitionResponseInfo =
          BatchDeletePartitionResponseInfo.readFrom(stream, clusterMap);
      partitionResponseInfoList.add(partitionResponseInfo);
    }
    return new BatchDeleteResponse(versionId, correlationId, clientId, partitionResponseInfoList, error);
  }
Reads from a stream and constructs a {@link BatchDeleteResponse}.
@param stream the {@link DataInputStream} to read from
@param clusterMap the {@link ClusterMap} to use
@return the constructed {@link BatchDeleteResponse}
@throws IOException
ambry-protocol/src/main/java/com/github/ambry/protocol/BatchDeleteResponse.java