public static FileCopyGetMetaDataResponse readFrom(
      @Nonnull DataInputStream stream) throws IOException {
    Objects.requireNonNull(stream, "stream should not be null");

    RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()];
    if (type != RequestOrResponseType.FileCopyGetMetaDataResponse) {
      throw new IllegalArgumentException("The type of request response is not compatible. Expected : {}, Actual : {}" +
          RequestOrResponseType.FileCopyGetMetaDataResponse + type);
    }
    short versionId = stream.readShort();
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    ServerErrorCode errorCode = ServerErrorCode.values()[stream.readShort()];

    if (errorCode != ServerErrorCode.NoError) {
      //Setting the number of logfiles to 0 as there are no logfiles to be read.
      return new FileCopyGetMetaDataResponse(versionId, correlationId, clientId, 0, new ArrayList<>(), null, errorCode, stream);
    }
    int numberOfLogfiles = stream.readInt();
    List<LogInfo> logInfos = new ArrayList<>();
    for (int i = 0; i < numberOfLogfiles; i++) {
      logInfos.add(StoreLogInfo.readFrom(stream));
    }
    String snapshotId = Utils.readIntString(stream);

    return new FileCopyGetMetaDataResponse(versionId, correlationId, clientId, numberOfLogfiles, logInfos, snapshotId, errorCode, stream);
  }
Deserialize a FileCopyGetMetaDataResponse
@param stream The stream to read from
@return The FileCopyGetMetaDataResponse
ambry-protocol/src/main/java/com/github/ambry/protocol/FileCopyGetMetaDataResponse.java