Package wol.configuration
Class Configuration
- java.lang.Object
-
- wol.configuration.Configuration
-
public class Configuration extends Object
This class represents a WakeOnLan configuration.- Author:
- Steffen Moldaner
-
-
Constructor Summary
Constructors Constructor Description Configuration()
Configuration(File file)
Creates a new configuration with the given file.Configuration(String path)
Creates a new configuration with the given path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getFile()
Returns the file for this configuration.Machine[]
getMachines()
Returns the machines.void
loadConfig()
Loads this configuration from the file returned bygetFile()
.void
saveConfig()
Saves this configuration to the file returned bygetFile()
.void
saveConfigAs(File file)
Saves this configuration to the given file.void
setMachines(Machine[] machines)
Sets the machines.
-
-
-
Constructor Detail
-
Configuration
public Configuration()
-
Configuration
public Configuration(String path)
Creates a new configuration with the given path.- Parameters:
path
- a path that denotes a file the configuration will be saved to
-
Configuration
public Configuration(File file)
Creates a new configuration with the given file. If the file exists the configurations loads immidiatly from this file.- Parameters:
file
- a file this configuration will be saved to- See Also:
loadConfig()
-
-
Method Detail
-
getMachines
public Machine[] getMachines()
Returns the machines.- Returns:
- the machines
-
setMachines
public void setMachines(Machine[] machines)
Sets the machines.- Parameters:
machines
- the machines
-
loadConfig
public void loadConfig() throws FileNotFoundException
Loads this configuration from the file returned bygetFile()
.- Throws:
FileNotFoundException
- if the file does not exist.- See Also:
getFile()
-
saveConfig
public void saveConfig() throws FileNotFoundException
Saves this configuration to the file returned bygetFile()
. This is equal to saveConfig(getFile()).- Throws:
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 reason- See Also:
getFile()
,saveConfigAs(File)
-
saveConfigAs
public void saveConfigAs(File file) throws FileNotFoundException
Saves this configuration to the given file. The configuration will then use this file for saves.- Parameters:
file
- the file- Throws:
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 reason- See Also:
saveConfigAs(File)
-
getFile
public File getFile()
Returns the file for this configuration.- Returns:
- the file
-
-