private static void writeActions(DataOutputStream dataOut, List<PatchAction> actions) throws IOException {
    dataOut.writeInt(actions.size());
    for (PatchAction each : actions) {
      int key;
      Class<?> clazz = each.getClass();
      if (clazz == CreateAction.class) key = CREATE_ACTION_KEY;
      else if (clazz == UpdateAction.class) key = UPDATE_ACTION_KEY;
      else if (clazz == DeleteAction.class) key = DELETE_ACTION_KEY;
      else if (clazz == ValidateAction.class) key = VALIDATE_ACTION_KEY;
      else throw new RuntimeException("Unknown action " + each);
      dataOut.writeInt(key);
      each.write(dataOut);
    }
  }
private static void writeActions(DataOutputStream dataOut, List<PatchAction> actions)