public static PurgeResponse readFrom(DataInputStream stream) throws IOException {
    RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()];
    if (type != RequestOrResponseType.PurgeResponse) {
      throw new IllegalArgumentException("The type of request response is not compatible");
    }
    short version = stream.readShort();
    if (version != PURGE_RESPONSE_VERSION_1) {
      throw new IllegalStateException("Unknown PurgeResponse version: " + version);
    }
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    ServerErrorCode error = ServerErrorCode.values()[stream.readShort()];
    return new PurgeResponse(correlationId, clientId, error);
  }
Helper to help construct {@link PurgeResponse} from the {@code stream}.
@param stream the stream to read bytes from
@return a {@link PurgeResponse} based on data read from the {@code stream}
@throws IOException if there was any problem reading the stream
ambry-protocol/src/main/java/com/github/ambry/protocol/PurgeResponse.java