/** * tries to determine the URL loader to use for this kind of file, returns * null if none can be found. * * @param file the file to return a URL converter for * @return the converter if one was found, null otherwise */ public static AbstractFileLoader getURLLoaderForFile(File file) { return getURLLoaderForFile(file.getAbsolutePath()); }
/** * tries to determine the URL loader to use for this kind of file, returns * null if none can be found. * * @param file the file to return a URL converter for * @return the converter if one was found, null otherwise */ public static AbstractFileLoader getURLLoaderForFile(File file) { return getURLLoaderForFile(file.getAbsolutePath()); }
@Override public void run() { try { m_Log.statusMessage("Reading from URL..."); AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (loader == null) throw new Exception( "No suitable URLSourcedLoader found for URL!\n" + u); ((URLSourcedLoader) loader).setURL(u.toString()); setInstances(loader.getDataSet()); } catch (Exception ex) { ex.printStackTrace(); m_Log.statusMessage("Problem reading " + u); JOptionPane.showMessageDialog(PreprocessPanel.this, "Couldn't read from URL:\n" + u + "\n" + ex.getMessage(), "Load Instances", JOptionPane.ERROR_MESSAGE); } m_IOThread = null; } };
@Override public void run() { try { m_Log.statusMessage("Reading from URL..."); AbstractFileLoader loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (loader == null) throw new Exception( "No suitable URLSourcedLoader found for URL!\n" + u); ((URLSourcedLoader) loader).setURL(u.toString()); setInstances(loader.getDataSet()); } catch (Exception ex) { ex.printStackTrace(); m_Log.statusMessage("Problem reading " + u); JOptionPane.showMessageDialog(PreprocessPanel.this, "Couldn't read from URL:\n" + u + "\n" + ex.getMessage(), "Load Instances", JOptionPane.ERROR_MESSAGE); } m_IOThread = null; } };
m_Loader = ConverterUtils.getLoaderForFile(location); } else { m_Loader = ConverterUtils.getURLLoaderForFile(location);
m_Loader = ConverterUtils.getLoaderForFile(location); } else { m_Loader = ConverterUtils.getURLLoaderForFile(location);
/** * Loads instances from a URL. * * @param u the URL to load from. */ protected void setInstancesFromURL(URL u) { boolean incremental = m_readIncrementally; try { m_Loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (m_Loader == null) throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u); // not an incremental loader? if (!(m_Loader instanceof IncrementalConverter)) incremental = false; // load ((URLSourcedLoader) m_Loader).setURL(u.toString()); if (incremental) { m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown); setInstances(m_Loader.getStructure()); } else { m_Summary.setShowZeroInstancesAsUnknown(false); setInstances(m_Loader.getDataSet()); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u, "Load Instances", JOptionPane.ERROR_MESSAGE); } }
/** * Loads instances from a URL. * * @param u the URL to load from. */ protected void setInstancesFromURL(URL u) { boolean incremental = m_readIncrementally; try { m_Loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (m_Loader == null) throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u); // not an incremental loader? if (!(m_Loader instanceof IncrementalConverter)) incremental = false; // load ((URLSourcedLoader) m_Loader).setURL(u.toString()); if (incremental) { m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown); setInstances(m_Loader.getStructure()); } else { m_Summary.setShowZeroInstancesAsUnknown(false); setInstances(m_Loader.getDataSet()); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u, "Load Instances", JOptionPane.ERROR_MESSAGE); } }