for (int i = 0; i < commandLine.getArgs().length; i += 2) {
String sourceFileName = commandLine.getArgs()[i];
String targetFileName = commandLine.getArgs()[i + 1];
Reader sourceReader = getReader(getFileInputStream(sourceFileName));
Reader targetReader = getReader(getFileInputStream(targetFileName));
Parser parser = new PlaintextParser(sourceReader, targetReader);
List<Alignment> currentAlignmentList = parser.parse();
alignmentList.addAll(currentAlignmentList);
sourceReader.close();
targetReader.close();
}
} else if (cls.equals("tmx")) {
if (commandLine.getArgs().length < 1) {
throw new WrongArgumentCountException("1, 2, 3, ...", commandLine.getArgs().length);
}
String languages = commandLine.getOptionValue('l');
String[] languageArray;
if (languages == null) {
languageArray = new String[0];
} else {
languageArray = languages.split(",");
if (languageArray.length != 2) {
throw new ParameterFormatException("languages");
}
}
for (String fileName : commandLine.getArgs()) {
Reader reader = getReader(getFileInputStream(fileName));
Parser parser;
if (languageArray.length == 0) {
parser = new TmxParser(reader);
} else {
parser = new TmxParser(reader, languageArray[0],
languageArray[1]);
}
List<Alignment> currentAlignmentList = parser.parse();
alignmentList.addAll(currentAlignmentList);
reader.close();
}
} else {