/** * Loads the muCommander CONFIGURATION. * Here, we don't try to convert preferences that were changed between muCommander versions, * as those are 'dynamic' preferences and as such can be ignored when the user installs new version. * * @throws IOException if an I/O error occurs. * @throws ConfigurationException if a CONFIGURATION related error occurs. */ void read() throws IOException, ConfigurationException { VersionedXmlConfigurationReader reader = new VersionedXmlConfigurationReader(); configuration.read(reader); }
/** * Loads configuration from the specified input stream. * <p> * This method will use the configuration reader set by {@link #setReaderFactory(ConfigurationReaderFactory)} if any, * or an {@link XmlConfigurationReader} instance if not. * </p> * @param in where to read the configuration from. * @throws ConfigurationException if a configuration error occurs. * @throws ConfigurationFormatException if a syntax error occurs in the configuration data. * @throws ConfigurationStructureException if the configuration data doesn't describe a valid configuration tree. * @throws ReaderConfigurationException if the {@link ConfigurationReaderFactory} isn't properly configured. * @throws IOException if an I/O error occurs. * @see #read() * @see #read(ConfigurationReader) * @see #read(Reader,ConfigurationReader) * @deprecated Application developers should use {@link #read(Reader)} instead. This method assumes the specified * {@link InputStream} to be <code>UTF-8</code> encoded. */ @Deprecated public void read(InputStream in) throws ConfigurationException, IOException { read(new InputStreamReader(in, Charset.forName("utf-8")), getReaderFactory().getReaderInstance()); }
/** * Loads configuration from the specified reader. * <p> * This method will use the configuration reader set by {@link #setReaderFactory(ConfigurationReaderFactory)} if any, * or an {@link XmlConfigurationReader} instance if not. * </p> * @param in where to read the configuration from. * @throws ConfigurationException if a configuration error occurs. * @throws ConfigurationFormatException if a syntax error occurs in the configuration data. * @throws ConfigurationStructureException if the configuration data doesn't describe a valid configuration tree. * @throws ReaderConfigurationException if the {@link ConfigurationReaderFactory} isn't properly configured. * @throws IOException if an I/O error occurs. * @see #read() * @see #read(ConfigurationReader) * @see #read(Reader,ConfigurationReader) */ public void read(Reader in) throws ConfigurationException, IOException { read(in, getReaderFactory().getReaderInstance()); }
/** * Loads configuration. * <p> * If a reader has been specified through {@link #setReaderFactory(ConfigurationReaderFactory)}, it * will be used to analyse the configuration. Otherwise, an {@link XmlConfigurationReader} * instance will be used. * </p> * <p> * If a configuration source has been specified through {@link #setSource(ConfigurationSource)}, it will be * used. Otherwise, this method will fail. * </p> * @throws IOException if an I/O error occurs. * @throws ConfigurationException if a configuration error occurs. * @throws SourceConfigurationException if no {@link ConfigurationSource} hasn't been set. * @throws ConfigurationFormatException if a syntax error occurs in the configuration data. * @throws ConfigurationStructureException if the configuration data doesn't describe a valid configuration tree. * @throws ReaderConfigurationException if the {@link ConfigurationReaderFactory} isn't properly configured. * @see #write() * @see #read(InputStream) * @see #read(ConfigurationReader) * @see #read(Reader,ConfigurationReader) */ public void read() throws ConfigurationException, IOException { read(getReaderFactory().getReaderInstance()); }
try {read(in = source.getReader(), reader);} finally { if(in != null) {
/** * Loads the muCommander CONFIGURATION. * @throws IOException if an I/O error occurs. * @throws ConfigurationException if a CONFIGURATION related error occurs. */ void read() throws IOException, ConfigurationException { VersionedXmlConfigurationReader reader = new VersionedXmlConfigurationReader(); configuration.read(reader); // Ensure backward compatibility configurationVersion = reader.getVersion(); if(configurationVersion == null || !configurationVersion.equals(RuntimeConstants.VERSION)) { // Rename preferences that have changed (from v0.8.5) configuration.renameVariable("show_hidden_files", SHOW_HIDDEN_FILES); configuration.renameVariable("auto_size_columns", AUTO_SIZE_COLUMNS); configuration.renameVariable("show_toolbar", TOOLBAR_VISIBLE); configuration.renameVariable("show_status_bar", STATUS_BAR_VISIBLE); configuration.renameVariable("show_command_bar", COMMAND_BAR_VISIBLE); } // Initializes MAC OS X specific values if(OsFamily.MAC_OS_X.isCurrent()) { if(configuration.getVariable(SHELL_ENCODING) == null) { configuration.setVariable(SHELL_ENCODING, "UTF-8"); configuration.setVariable(AUTODETECT_SHELL_ENCODING, false); } } }