import java.util.Properties;
String propertiesFileName = "my_properties.txt";
SAVE PREFERENCES:
Properties unsavedProperties = new Properties();
unsavedProperties.setProperty("my_name", "Uki");
OutputStream propOut = new FileOutputStream(new File(propertiesFileName));
unsavedProperties.store(propOut, "My Server properties");
LATER READ THE SAVED PREFERENCES:
InputStream inStream = new FileInputStream(propertiesFileName);
Properties savedPropeties = new Properties();
savedPropeties.load(inStream);
String myName = savedPropeties.getProperty("my_name");
No comments:
Post a Comment