void run(Pseudolocalizer.PseudolocalizerArguments arguments) throws IOException {
    List<String> fileNames = arguments.getFileNames();
    PseudolocalizationPipeline pipeline = arguments.getPipeline();
    if (arguments.isInteractive()) {
      runStdin(pipeline);
      return;
    }
    if (fileNames.size() == 0) {
      // if no files given, read from stdin / write to stdout
      MessageCatalog msgCat = FormatRegistry.getMessageCatalog(arguments.getType());
      writeMessages(msgCat, readAndProcessMessages(pipeline, msgCat, System.in), System.out);
      return;
    }

    // get the suffix to use for output file names
    String suffix = arguments.getVariant();
    if (suffix == null) {
      suffix = "_pseudo";
    } else {
      suffix = "_" + suffix;
    }

    for (String fileName : fileNames) {
      File file = new File(fileName);
      if (!file.exists()) {
        System.err.println("File " + fileName + " not found");
        continue;
      }

      // get the extension of the input file and construct the output file name
      int lastDot = fileName.lastIndexOf('.');
      String extension;
      String outFileName;
      if (lastDot >= 0) {
        extension = fileName.substring(lastDot + 1);
        outFileName = fileName.substring(0, lastDot) + suffix + "." + extension;
      } else {
        extension = "";
        outFileName = fileName + suffix;
      }
      System.out.println("Processing " + fileName + " into " + outFileName);

      // get the message catalog object for the specified (or inferred) file type
      String fileType = arguments.getType();
      if (fileType == null) {
        fileType = extension;
      }
      MessageCatalog msgCat = FormatRegistry.getMessageCatalog(fileType);

      // read and process messages
      InputStream inputStream = new FileInputStream(file);
      List<Message> processedMessages = readAndProcessMessages(pipeline, msgCat, inputStream);

      OutputStream outputStream = new FileOutputStream(new File(outFileName));
      writeMessages(msgCat, processedMessages, outputStream);
    }
  }