X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fload%2Fxml%2FGzipFileLoader.java;fp=tim%2Fprune%2Fload%2Fxml%2FGzipFileLoader.java;h=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hp=4be2bab3fc521627a65b793d490f5a01c173bfd4;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465;p=GpsPrune.git diff --git a/tim/prune/load/xml/GzipFileLoader.java b/tim/prune/load/xml/GzipFileLoader.java deleted file mode 100644 index 4be2bab..0000000 --- a/tim/prune/load/xml/GzipFileLoader.java +++ /dev/null @@ -1,74 +0,0 @@ -package tim.prune.load.xml; - -import java.io.File; -import java.io.FileInputStream; -import java.util.zip.GZIPInputStream; -import tim.prune.App; -import tim.prune.I18nManager; -import tim.prune.data.SourceInfo; -import tim.prune.load.MediaLinkInfo; - -/** - * Class to handle the loading of gzipped xml files - */ -public class GzipFileLoader -{ - /** App for callback of file loading */ - private App _app = null; - /** Object to do the handling of the xml */ - XmlFileLoader _xmlLoader = null; - - /** - * Constructor - * @param inApp App object - * @param inXmlLoader object to do the xml handling - */ - public GzipFileLoader(App inApp, XmlFileLoader inXmlLoader) - { - _app = inApp; - _xmlLoader = inXmlLoader; - } - - /** - * Open the selected file and select appropriate xml loader - * @param inFile File to open - */ - public void openFile(File inFile) - { - GZIPInputStream istream = null; - try - { - istream = new GZIPInputStream(new FileInputStream(inFile)); - _xmlLoader.reset(); - // Parse the stream using either Xerces or java classes - _xmlLoader.parseXmlStream(istream); - XmlHandler handler = _xmlLoader.getHandler(); - if (handler == null) { - _app.showErrorMessage("error.load.dialogtitle", "error.load.noread"); - } - else - { - // Send back to app - SourceInfo sourceInfo = new SourceInfo(inFile, - (handler instanceof GpxHandler?SourceInfo.FILE_TYPE.GPX:SourceInfo.FILE_TYPE.KML)); - _app.informDataLoaded(handler.getFieldArray(), handler.getDataArray(), - null, sourceInfo, handler.getTrackNameList(), - new MediaLinkInfo(inFile, handler.getLinkArray())); - } - } - catch (Exception e) - { - // Error occurred, could be a non-xml file borking the parser - _app.showErrorMessageNoLookup("error.load.dialogtitle", - I18nManager.getText("error.load.othererror") + " " + e.getClass().getName()); - // It would be nice to verify the filename of the file inside the gz, - // but the java classes don't give access to this information - } - finally { - try { - istream.close(); - } - catch (Exception e2) {} - } - } -}