001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.io;
003
004import java.io.IOException;
005
006import org.openstreetmap.josm.data.gpx.GpxData;
007import org.xml.sax.SAXException;
008
009/**
010 * Abstraction of {@code GpxReader} and {@code NmeaReader}.
011 * @since 14010
012 */
013public interface IGpxReader {
014
015    /**
016     * Parse the GPX data.
017     *
018     * @param tryToFinish true, if the reader should return at least part of the GPX
019     * data in case of an error.
020     * @return true if file was properly parsed, false if there was error during
021     * parsing but some data were parsed anyway
022     * @throws SAXException if any SAX parsing error occurs
023     * @throws IOException if any I/O error occurs
024     */
025    boolean parse(boolean tryToFinish) throws SAXException, IOException;
026
027    /**
028     * Replies the GPX data.
029     * @return The GPX data
030     */
031    GpxData getGpxData();
032}