lejos.internal.io.SystemSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.internal.io;
public class SystemSettings {
/**
* Get the value for a leJOS persistent setting as a String
*
* @param key the name of the setting
* @param defaultValue the default value
* @return the value
*/
public static String getStringSetting(String key, String defaultValue) {
return Settings.getProperty(key, defaultValue);
}
/**
* Get the value for a leJOS persistent setting as an Integer
*
* @param key the name of the setting
* @param defaultValue the default value
* @return the value
*/
public static int getIntSetting(String key, int defaultValue) {
String s = getStringSetting(key, null);
if (s == null)
return defaultValue;
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
return defaultValue;
}
}
}