Package wol.configuration
Class Configuration
- java.lang.Object
-
- wol.configuration.Configuration
-
public class Configuration extends java.lang.ObjectThis class represents a WakeOnLan configuration.- Author:
- Steffen Moldaner
-
-
Constructor Summary
Constructors Constructor Description Configuration()Configuration(java.io.File file)Creates a new configuration with the given file.Configuration(java.lang.String path)Creates a new configuration with the given path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetFile()Returns the file for this configuration.Machine[]getMachines()Returns the machines.voidloadConfig()Loads this configuration from the file returned bygetFile().voidsaveConfig()Saves this configuration to the file returned bygetFile().voidsaveConfigAs(java.io.File file)Saves this configuration to the given file.voidsetMachines(Machine[] machines)Sets the machines.
-
-
-
Constructor Detail
-
Configuration
public Configuration()
-
Configuration
public Configuration(java.lang.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(java.io.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 java.io.FileNotFoundExceptionLoads this configuration from the file returned bygetFile().- Throws:
java.io.FileNotFoundException- if the file does not exist.- See Also:
getFile()
-
saveConfig
public void saveConfig() throws java.io.FileNotFoundExceptionSaves this configuration to the file returned bygetFile(). This is equal to saveConfig(getFile()).- Throws:
java.io.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(java.io.File file) throws java.io.FileNotFoundExceptionSaves this configuration to the given file. The configuration will then use this file for saves.- Parameters:
file- the file- Throws:
java.io.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 java.io.File getFile()
Returns the file for this configuration.- Returns:
- the file
-
-