ConfigFile Class

Used to access and save configuration information stored in a JSON file. Provides an option to encrypt the JSON file.

Constructors

ConfigFile( javaxt.io.File file )
ConfigFile( String path )

Public Methods

exists( ) returns boolean
Returns true if the file exists.
getDirectory( ) returns javaxt.io.Directory
delete( ) returns void
Used to delete the config file, if it exists.
getConfig( ) returns JSONObject
Returns the current config (json document).
getConfig( String username, String password ) returns JSONObject
Used to decrypt and parse a config file (json document).
save( ) returns void
Used to save the config file.
save( String username, String password ) returns void
Used to encrypt and save the config file.
save( JSONObject config, String username, String password ) returns void
Used to encrypt and save the config file.
updateDir( String key, boolean create ) returns void
Used to update a path to a directory defined in the config file. Resolves both canonical and relative paths (relative to the configFile).
updateDir( String key, JSONObject config, boolean create ) returns void
Used to update a path to a directory defined in a given config. Resolves both canonical and relative paths (relative to the configFile).
updateFile( String key ) returns void
Used to update a path to a file defined in the config file. Resolves both canonical and relative paths (relative to the configFile).
updateFile( String key, JSONObject config ) returns void
Used to update a path to a file defined a given config. Resolves both canonical and relative paths (relative to the configFile).

Static Methods

updateDir( String key, JSONObject config, javaxt.io.File configFile, boolean create ) returns void
Used to update a path to a directory defined in a given config. Resolves both canonical and relative paths (relative to the configFile).
updateFile( String key, JSONObject config, javaxt.io.File configFile ) returns void
Used to update a path to a file defined in a config. Resolves both canonical and relative paths (relative to a configFile).
getFile( String path, javaxt.io.File file ) returns javaxt.io.File
Returns a File for a given path. Resolves both canonical and relative paths (relative to the given file).
pathFull canonical path or a relative path
fileIf a relative path is given, the path is resolved to the given file