/**
* Reads all data from the file and send it to the sink.
*/
public void run() {
InputStream inputStream = null;
FastXmlParser parser = null;
try {
sink.initialize(Collections.<String, Object>emptyMap());
// make "-" an alias for /dev/stdin
if (file.getName().equals("-")) {
inputStream = System.in;
} else {
inputStream = new FileInputStream(file);
}
inputStream =
new CompressionActivator(compressionMethod).
createCompressionInputStream(inputStream);
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.IS_COALESCING, false);
factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
factory.setProperty(XMLInputFactory.IS_VALIDATING, false);
XMLStreamReader xpp = factory.createXMLStreamReader(inputStream);
parser = new FastXmlParser(sink, xpp, enableDateParsing);
parser.readOsm();
sink.complete();
} catch (Exception e) {
throw new OsmosisRuntimeException("Unable to read XML file " + file + ".", e);