Class FileDatabaseConfigFile

java.lang.Object
example.app.filedatabase.FileDatabaseConfigFile

public final class FileDatabaseConfigFile extends Object

Class FileDatabaseConfigFile

This class provides the methods for interacting with the database.config file.
Structure of the database.config file:
  • Every key and it's value is separated by a '='
  • Every key value pair is separated by a line terminator
  • "root" key represents root database directory
  • "root" key's value represents it's directory path
  • Lines starting with '#' are ignored
  • Constructor Details

    • FileDatabaseConfigFile

      public FileDatabaseConfigFile()
  • Method Details

    • create

      public static void create() throws IOException
      This method creates a new database.config file. The file path is the present directory
      Throws:
      IOException - if the file could not be created
    • rootPath

      public static String rootPath() throws IOException, FileDatabaseConfigFileException
      This method returns the path to root directory path from the database.config file. If the root key or it's value not present, null is returned
      Returns:
      the path to root directory path or null
      Throws:
      IOException - if the file could not be read
      FileDatabaseConfigFileException