/** * 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()); }