public static AdminRequest readFrom(DataInputStream stream, ClusterMap clusterMap) throws IOException {
    Short versionId = stream.readShort();
    if (!versionId.equals(ADMIN_REQUEST_VERSION_V2)) {
      throw new IllegalStateException("Unrecognized version for AdminRequest: " + versionId);
    }
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    AdminRequestOrResponseType type = AdminRequestOrResponseType.values()[stream.readShort()];
    PartitionId id = null;
    if (stream.readByte() == 1) {
      id = clusterMap.getPartitionIdFromStream(stream);
    }
    return new AdminRequest(type, id, correlationId, clientId);
  }
Reads from a stream and constructs an {@link AdminRequest}.
@param stream the {@link DataInputStream} to read from.
@param clusterMap the {@link ClusterMap} in use.
@return {@link AdminRequest} that is deserialized from the {@code stream}.
@throws IOException if there is an I/O error reading from {@code stream}
ambry-protocol/src/main/java/com/github/ambry/protocol/AdminRequest.java