java properties
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.Properties;
public class PropertiesTest {
public static void main(String[] args) throws Exception {
// from file "myProperties.txt"
Properties p = new Properties();
try{
FileInputStream propFile = new FileInputStream("myProperties.txt");
p.load(propFile);
p.list(System.out);
} catch (FileNotFoundException e) {
}
// Write properties file.
try {
p.setProperty("lastdir", "c:\\tmp");
p.store(new FileOutputStream("myProperties.txt"), null);
} catch (IOException e) {
}
}
}
String propFile = this.getServletContext().getRealPath("/") + "/WEB-INF/classes/security.properties";
Properties prop = new Properties();
try{ prop.load(new FileInputStream(propFile)); }
catch(IOException ioe){ throw (new SecurityException(("Failed to initialize properties with default properties file " + propFile))); }
SecureStream ss = new SecureStream (in, out, prop);
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.Properties;
public class PropertiesTest {
public static void main(String[] args) throws Exception {
// from file "myProperties.txt"
Properties p = new Properties();
try{
FileInputStream propFile = new FileInputStream("myProperties.txt");
p.load(propFile);
p.list(System.out);
} catch (FileNotFoundException e) {
}
// Write properties file.
try {
p.setProperty("lastdir", "c:\\tmp");
p.store(new FileOutputStream("myProperties.txt"), null);
} catch (IOException e) {
}
}
}
String propFile = this.getServletContext().getRealPath("/") + "/WEB-INF/classes/security.properties";
Properties prop = new Properties();
try{ prop.load(new FileInputStream(propFile)); }
catch(IOException ioe){ throw (new SecurityException(("Failed to initialize properties with default properties file " + propFile))); }
SecureStream ss = new SecureStream (in, out, prop);