public class Configuration extends Object
Constructor and Description |
---|
Configuration() |
Configuration(File file)
Creates a new configuration with the given file.
|
Configuration(String path)
Creates a new configuration with the given path.
|
Modifier and Type | Method and Description |
---|---|
File |
getFile()
Returns the file for this configuration.
|
Machine[] |
getMachines()
Returns the machines.
|
void |
loadConfig()
Loads this configuration from the file returned by
getFile() . |
void |
saveConfig()
Saves this configuration to the file returned by
getFile() . |
void |
saveConfigAs(File file)
Saves this configuration to the given file.
|
void |
setMachines(Machine[] machines)
Sets the machines.
|
public Configuration()
public Configuration(String path)
path
- a path that denotes a file the configuration will be saved topublic Configuration(File file)
file
- a file this configuration will be saved toloadConfig()
public Machine[] getMachines()
public void setMachines(Machine[] machines)
machines
- the machinespublic void loadConfig() throws FileNotFoundException
getFile()
.FileNotFoundException
- if the file does not exist.getFile()
public void saveConfig() throws FileNotFoundException
getFile()
.
This is equal to saveConfig(getFile()).FileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot
be created, or cannot be opened for any other reasongetFile()
,
saveConfigAs(File)
public void saveConfigAs(File file) throws FileNotFoundException
file
- the fileFileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot
be created, or cannot be opened for any other reasonsaveConfigAs(File)
public File getFile()