System.exit(0);
}
private void convert(File source, NavigationFormat format, File target) throws IOException {
NavigationFormatParser parser = new NavigationFormatParser();
ParserResult result = parser.read(source);
if (!result.isSuccessful()) {
log.severe("Could not read source '" + source.getAbsolutePath() + "'");
logFormatNames(getReadFormatsSortedByName());
System.exit(20);
}
if (format.isSupportsMultipleRoutes()) {
parser.write(result.getAllRoutes(), (MultipleRoutesFormat) format, target);
} else {
int fileCount = getNumberOfFilesToWriteFor(result.getTheRoute(), format, false);
File[] targets = createTargetFiles(target, fileCount, format.getExtension(), format.getMaximumFileNameLength());
for (File t : targets) {
if (t.exists()) {
log.severe("Target '" + t.getAbsolutePath() + "' already exists; stopping.");
System.exit(13);
}
}
parser.write(result.getTheRoute(), format, false, false, null, targets);
}
}