Interface FileConfiguration

    • Method Detail

      • load

        void load()
           throws ConfigurationException
        Load the configuration from the underlying URL. If the URL is not specified, it attempts to locate the specified file name.
        Throws:
        ConfigurationException - if an error occurs during the load operation
      • load

        void load​(java.lang.String fileName)
           throws ConfigurationException
        Locate the specified file and load the configuration.
        Parameters:
        fileName - the name of the file loaded
        Throws:
        ConfigurationException - if an error occurs during the load operation
      • load

        void load​(java.io.InputStream in,
                  java.lang.String encoding)
           throws ConfigurationException
        Load the configuration from the specified stream, using the specified encoding. If the encoding is null the default encoding is used.
        Parameters:
        in - the input stream
        encoding - the encoding used. null to use the default encoding
        Throws:
        ConfigurationException - if an error occurs during the load operation
      • save

        void save​(java.lang.String fileName)
           throws ConfigurationException
        Save the configuration to the specified file.
        Parameters:
        fileName - the name of the file to be saved
        Throws:
        ConfigurationException - if an error occurs during the save operation
      • save

        void save​(java.io.File file)
           throws ConfigurationException
        Save the configuration to the specified file.
        Parameters:
        file - specifies the file to be saved
        Throws:
        ConfigurationException - if an error occurs during the save operation
      • save

        void save​(java.io.OutputStream out,
                  java.lang.String encoding)
           throws ConfigurationException
        Save the configuration to the specified stream, using the specified encoding. If the encoding is null the default encoding is used.
        Parameters:
        out - the output stream
        encoding - the encoding to be used
        Throws:
        ConfigurationException - if an error occurs during the save operation
      • getFileName

        java.lang.String getFileName()
        Return the name of the file.
        Returns:
        the file name
      • setFileName

        void setFileName​(java.lang.String fileName)
        Set the name of the file.
        Parameters:
        fileName - the name of the file
      • getBasePath

        java.lang.String getBasePath()
        Returns the base path. One way to specify the location of a configuration source is by setting its base path and its file name. This method returns this base path. The concrete value returned by this method depends on the way the location of the configuration file was set. If methods like setFile() or setURL() were used, the base path typically points to the parent directory of the configuration file (e.g. for the URL file:/temp/test.properties the base path will be file:/temp/). If the base path was explicitly set using setBasePath(), this method will return the exact value specified here without further modifications.
        Returns:
        the base path
        See Also:
        AbstractFileConfiguration.setBasePath(String)
      • setBasePath

        void setBasePath​(java.lang.String basePath)
        Sets the base path. The methods setBasePath() and setFileName() can be used together to specify the location of the configuration file to be loaded. If relative file names are to be resolved (e.g. for the include files supported by PropertiesConfiguration), this base path will be used.
        Parameters:
        basePath - the base path.
      • getFile

        java.io.File getFile()
        Return the file where the configuration is stored.
        Returns:
        the configuration file
      • setFile

        void setFile​(java.io.File file)
        Set the file where the configuration is stored.
        Parameters:
        file - the file
      • getURL

        java.net.URL getURL()
        Return the URL where the configuration is stored.
        Returns:
        the URL of the configuration
      • setURL

        void setURL​(java.net.URL url)
        The URL where the configuration is stored.
        Parameters:
        url - the URL
      • setAutoSave

        void setAutoSave​(boolean autoSave)
        Enable or disable the automatically saving of modified properties to the disk.
        Parameters:
        autoSave - true to enable, false to disable
        Since:
        1.1
      • isAutoSave

        boolean isAutoSave()
        Tells if properties are automatically saved to the disk.
        Returns:
        true if auto-saving is enabled, false otherwise
        Since:
        1.1
      • reload

        void reload()
        Reload the configuration.
        Since:
        1.1
      • getEncoding

        java.lang.String getEncoding()
        Return the encoding used to store the configuration file. If the value is null the default encoding is used.
        Returns:
        the current encoding
        Since:
        1.1
      • setEncoding

        void setEncoding​(java.lang.String encoding)
        Set the encoding used to store the configuration file. Set the encoding to null to use the default encoding.
        Parameters:
        encoding - the encoding to use
        Since:
        1.1