public static CatchupStatusAdminRequest readFrom(DataInputStream stream, AdminRequest adminRequest)
      throws IOException {
    Short versionId = stream.readShort();
    long acceptableLagInBytes;
    short numReplicasCaughtUpPerPartition = Short.MAX_VALUE;
    switch (versionId) {
      case VERSION_V1:
        acceptableLagInBytes = stream.readLong();
        break;
      case VERSION_V2:
        acceptableLagInBytes = stream.readLong();
        numReplicasCaughtUpPerPartition = stream.readShort();
        break;
      default:
        throw new IllegalStateException("Unrecognized version for CatchupStatusAdminRequest: " + versionId);
    }
    return new CatchupStatusAdminRequest(acceptableLagInBytes, numReplicasCaughtUpPerPartition, adminRequest);
  }
Reads from a stream and constructs a {@link CatchupStatusAdminRequest}.
@param stream the stream to read from
@param adminRequest the {@link AdminRequest} that contains some necessary headers.
@return the {@link CatchupStatusAdminRequest} constructed from the {@code stream}.
@throws IOException if there is any problem reading from the stream
ambry-protocol/src/main/java/com/github/ambry/protocol/CatchupStatusAdminRequest.java