// Connect the tasks together.
reader.setChangeSink(tagSorter);
tagSorter.setChangeSink(writer);
// Run the changeset extraction.
reader.run();
// Delete the destination file if it already exists.
if (file.exists()) {
if (!file.delete()) {
throw new OsmosisRuntimeException("Unable to delete existing file " + file + ".");